mirror of
https://github.com/outline/outline.git
synced 2026-12-02 17:52:07 +03:00
fix: test
This commit is contained in:
1 parent
e330be11f3
commit
e54a35a2f3
2 files changed
+22
No files matched your search
@@ -486,6 +486,25 @@ describe("SearchHelper", () => {
|
||||
);
|
||||
expect(totalCount).toBe(1);
|
||||
});
|
||||
|
||||
test("should correctly handle removal of trailing spaces", async () => {
|
||||
const team = await buildTeam();
|
||||
const user = await buildUser({ teamId: team.id });
|
||||
const collection = await buildCollection({
|
||||
teamId: team.id,
|
||||
userId: user.id,
|
||||
});
|
||||
const document = await buildDocument({
|
||||
teamId: team.id,
|
||||
userId: user.id,
|
||||
collectionId: collection.id,
|
||||
text: "env: some env",
|
||||
});
|
||||
document.title = "change";
|
||||
await document.save();
|
||||
const { totalCount } = await SearchHelper.searchForUser(user, "env: ");
|
||||
expect(totalCount).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#searchTitlesForUser", () => {
|
||||
|
||||
@@ -556,6 +556,9 @@ export default class SearchHelper {
|
||||
|
||||
return (
|
||||
queryParser()(
|
||||
// Although queryParser trims the query, looks like there's a
|
||||
// bug for certain cases where it removes other characters in addition to
|
||||
// spaces. Ref: https://github.com/caub/pg-tsquery/issues/27
|
||||
quotedSearch ? limitedQuery.trim() : `${limitedQuery.trim()}*`
|
||||
)
|
||||
// Remove any trailing join characters
|
||||
|
||||
Reference in new issue
Block a user