diff --git a/frontend/src/lib/api/feed.test.ts b/frontend/src/lib/api/feed.test.ts index fed12e06..bc05aa09 100644 --- a/frontend/src/lib/api/feed.test.ts +++ b/frontend/src/lib/api/feed.test.ts @@ -106,24 +106,32 @@ describe("feed filters on the wire", () => { [...(block?.[1] ?? "").matchAll(/^\s{4}(\w+):/gm)].flatMap((m) => (m[1] ? [m[1]] : [])), ); known.add("sort").add("seed").add("cursor").add("limit"); // read by /feed itself - const everything = sent( - { - tags: [1], - tagModes: { language: "and", topic: "and", other: "and" }, - channelIds: ["UC"], - untagged: true, - q: "x", - maxAgeDays: 3, - dateFrom: "2024-01-01", - dateTo: "2024-01-02", - minDuration: 1, - maxDuration: 2, - sort: "shuffle", - seed: 1, - }, - "C", - ); - const unknown = [...new Set(everything.keys())].filter((k) => !known.has(k)); + // Every field set (Required: a new filter field fails tsc here until it has a value, so its key + // is checked too). `year` wins over the other date filters, so the set goes out once with it + // and once without. + const all: Required = { + tags: [1], + tagModes: { language: "and", topic: "and", other: "and" }, + q: "x", + sort: "shuffle", + seed: 1, + scope: "all", + includeNormal: false, + includeShorts: true, + includeLive: true, + show: "all", + librarySource: "search", + untagged: true, + channelIds: ["UC"], + maxAgeDays: 3, + minDuration: 1, + maxDuration: 2, + dateFrom: "2024-01-01", + dateTo: "2024-01-02", + year: 2020, + }; + const everything = [...sent(all, "C").keys(), ...sent({ ...all, year: undefined }, "C").keys()]; + const unknown = [...new Set(everything)].filter((k) => !known.has(k)); expect(unknown).toEqual([]); expect(known.has("tag_mode_topic")).toBe(true); // the parse found the real list }); diff --git a/frontend/src/lib/api/plexFilters.dom.test.ts b/frontend/src/lib/api/plexFilters.dom.test.ts index f5bbe656..cdeef134 100644 --- a/frontend/src/lib/api/plexFilters.dom.test.ts +++ b/frontend/src/lib/api/plexFilters.dom.test.ts @@ -8,7 +8,8 @@ import { plexFiltersToParams, type PlexFilters } from "./plex"; // the backend renames does not fail anywhere — the filter silently stops narrowing while its chip // still shows (E32 S2, the sibling of lib/api/feed.test.ts). Every key the filter set can put on the // wire must be a field of the backend's LibraryFilters, which /library and /facets both inject. -const EVERYTHING: PlexFilters = { +// Required: a new filter field fails tsc here until it has a value, so the checks below see its key. +const EVERYTHING: Required = { genres: ["Drama"], genreMode: "all", contentRatings: ["PG"],