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(); }); });