import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { dirname, join } from "node:path";
import test from "node:test";
import { fileURLToPath } from "node:url";

const testDirectory = dirname(fileURLToPath(import.meta.url));

test("dashboard filters use the shared checkbox dropdown UI", () => {
  const source = readFileSync(
    join(testDirectory, "cdc-gpsf-dashboard-filters.tsx"),
    "utf8",
  );

  for (const filter of ["Working Group", "Category", "Status", "Primary Agency"]) {
    assert.match(
      source,
      new RegExp(`label="${filter}"[\\s\\S]*?showCheckbox`),
    );
  }
});
