test.govlab/quality/core/selectors/block.selector.test.ts

test.govlab/quality/core/selectors/block.selector.test.ts is a file in Codebase Testing. 14 lines of code and 0 definitions.

import { expect, test } from "vitest";
import { filterBlockExcluded } from "@govlab/quality/core/selectors/block.selector.ts";

test("filterBlockExcluded returns the findings unchanged when there are no exclusions", () => {
    const findings = [{ file: "a.ts", line: 3, ruleId: "no-x" }];
    expect(filterBlockExcluded(findings, [], "/root")).toBe(findings);
});

test("filterBlockExcluded keeps findings whose excluded file cannot be read", () => {
    const findings = [
        { file: "a.ts", line: 3, ruleId: "no-x" },
        { file: "b.ts", line: 3, ruleId: "no-x" },
    ];
    const kept = filterBlockExcluded(findings, [{ file: "z.ts", functions: ["gone"], rule: "no-x" }], "/root");
    expect(kept).toHaveLength(findings.length);
});