Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Jan 13, 2025
1 parent 1c44b96 commit f6344a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/lib/utils/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function userDocs(user?: Nullable<User>, access?: Access): string {
* @returns formatted query
*/
export function tag(t: string): string {
return `tag:"${t}"`;
return `+tag:"${t}"`;
}

/**
Expand All @@ -58,7 +58,7 @@ export function tag(t: string): string {
* @returns formatted query
*/
export function kv(key: string, value: string): string {
return `data_${key}:"${value}"`;
return `+data_${key}:"${value}"`;
}

/**
Expand Down
8 changes: 3 additions & 5 deletions src/lib/utils/tests/search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ describe("search utilities", () => {
});

test("userDocs", () => {
expect(userDocs(me)).toStrictEqual(`+user:${slugify(me.name!)}-${me.id}`);
expect(userDocs(me)).toStrictEqual(`user:${me.id}`);

expect(userDocs(me, "public")).toStrictEqual(
`+user:${slugify(me.name!)}-${me.id} access:public`,
);
expect(userDocs(me, "public")).toStrictEqual(`user:${me.id} access:public`);

expect(userDocs(me, "private")).toStrictEqual(
`+user:${slugify(me.name!)}-${me.id} access:private`,
`user:${me.id} access:private`,
);
});

Expand Down

0 comments on commit f6344a4

Please sign in to comment.