Files
siftlode/frontend/src/components/facetOption.test.ts
T
peter a4775e1cd0 fix(ui): the filter rail shows no tag counts until the facets land
It printed the tag's whole-library count as the current filter's while the
facets loaded, and for good when they failed: live, "Music 238" beside a
search that matched 3 of its channels. Ordering still falls back to it.
2026-10-03 02:43:52 +02:00

20 lines
773 B
TypeScript

import { describe, expect, it } from "vitest";
import type { Tag } from "../lib/api";
import { facetOption } from "./facetOption";
const music = { id: 7, name: "Music", category: "topic", channel_count: 238 } as Tag;
describe("a tag as a filter row", () => {
it("counts the current filter's channels", () => {
expect(facetOption(music, { "7": 3 }).count).toBe(3);
expect(facetOption(music, {}).count).toBe(0);
});
// E31 review 2, live: with the summary failed, the rail read "Music 238" beside a search that matched
// 3 Music channels — the whole library's count printed as the filter's.
it("shows no count until the facets land, rather than the whole library's", () => {
expect(facetOption(music, undefined).count).toBeUndefined();
});
});