test(feed): cover the filter-bar gaps deep-review flagged

- test_feed_views: extend _seed_tagged so a channel carries 2+ tags in a
  non-topic category, and add language-AND / other-AND equivalence cases — the
  per-category any/all generalization was only exercised for topic.
- tagModes.test: coerceTagModes migration (legacy global tagMode -> topic),
  per-category preservation, invalid-value coercion, defaults.
- urlState.dom.test: per-category tag-mode URL round-trip + legacy ?tagmode=and
  migration into the topic slot.
- Combobox.dom.test: the any/all match footer (hidden below 2 selections, reports
  a mode change at 2+).
- chipOverflow.test: the all/some/count fit boundaries and the +N reservation.
This commit is contained in:
2026-08-22 06:33:48 +02:00
parent e90603d4db
commit 7692253636
5 changed files with 193 additions and 2 deletions
+42
View File
@@ -0,0 +1,42 @@
import { describe, it, expect } from "vitest";
import { coerceTagModes, DEFAULT_TAG_MODES } from "./tagModes";
// coerceTagModes runs on every persisted saved-view blob (SavedViewsProvider.asFilters), on the URL
// parse, and on the localStorage seed — the single migration point for the legacy global `tagMode`.
describe("coerceTagModes", () => {
it("defaults to all-'or' for empty/undefined input", () => {
expect(coerceTagModes(undefined)).toEqual(DEFAULT_TAG_MODES);
expect(coerceTagModes({})).toEqual(DEFAULT_TAG_MODES);
expect(coerceTagModes(null)).toEqual(DEFAULT_TAG_MODES);
});
it("migrates a legacy global tagMode:'and' into the topic slot only", () => {
expect(coerceTagModes({ tagMode: "and" })).toEqual({
language: "or",
topic: "and",
other: "or",
});
});
it("ignores a legacy tagMode:'or' (stays all-'or')", () => {
expect(coerceTagModes({ tagMode: "or" })).toEqual(DEFAULT_TAG_MODES);
});
it("preserves an explicit per-category tagModes object", () => {
expect(coerceTagModes({ tagModes: { language: "and", topic: "or", other: "and" } })).toEqual({
language: "and",
topic: "or",
other: "and",
});
});
it("an explicit per-category value wins over the legacy scalar", () => {
// A blob carrying both should honour the new per-category topic, not the legacy global.
expect(coerceTagModes({ tagMode: "and", tagModes: { topic: "or" } }).topic).toBe("or");
});
it("coerces invalid/garbage values to 'or'", () => {
expect(coerceTagModes({ tagModes: { topic: "x" as unknown as "or" } }).topic).toBe("or");
expect(coerceTagModes({ tagModes: { language: 1 as unknown as "or" } }).language).toBe("or");
});
});