sharing.test.ts round-tripped shared=with_me, which facets.test.ts already does with every facet; its unknown-value case moves there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -21,4 +21,8 @@ describe("the board's filter URL", () => {
|
|||||||
expect(facets).toEqual({});
|
expect(facets).toEqual({});
|
||||||
expect(facetCount(facets)).toBe(0);
|
expect(facetCount(facets)).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("ignores a shared value it doesn't know", () => {
|
||||||
|
expect(facetsFromQuery({ shared: "by_me" })).toEqual({});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
|
|
||||||
import { canEditText, isOwnNote } from "./sharing";
|
import { canEditText, isOwnNote } from "./sharing";
|
||||||
import { facetCount, facetsFromQuery, facetsToQuery } from "./facets";
|
|
||||||
import type { Note } from "../stores/notes";
|
import type { Note } from "../stores/notes";
|
||||||
|
|
||||||
const note = (extra: Partial<Note>): Note => ({ ...({} as Note), ...extra });
|
const note = (extra: Partial<Note>): Note => ({ ...({} as Note), ...extra });
|
||||||
@@ -21,16 +20,3 @@ describe("how a note is held", () => {
|
|||||||
expect(canEditText(note({ permission: "view" }))).toBe(false);
|
expect(canEditText(note({ permission: "view" }))).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("the Shared with me facet", () => {
|
|
||||||
it("round-trips through the URL and counts as one filter", () => {
|
|
||||||
const facets = facetsFromQuery({ shared: "with_me" });
|
|
||||||
expect(facets).toEqual({ shared: "with_me" });
|
|
||||||
expect(facetsToQuery(facets)).toEqual({ shared: "with_me" });
|
|
||||||
expect(facetCount(facets)).toBe(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("ignores a value it doesn't know", () => {
|
|
||||||
expect(facetsFromQuery({ shared: "by_me" })).toEqual({});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|||||||
Reference in New Issue
Block a user