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

> 14 lines of code and 0 definitions.

Tree: Codebase Testing
Language: typescript
Canonical: https://banes-lab.com/anatomy/testing#file-testing-test-govlab-quality-core-selectors-block-selector-test-ts
Source text: https://banes-lab.com/source/testing/test.govlab/quality/core/selectors/block.selector.test.ts.txt

Listed in [test.govlab/quality/core/selectors](https://banes-lab.com/api/source/testing/test.govlab/quality/core/selectors.md), before [test.govlab/quality/core/selectors/catalog.selector.test.ts](https://banes-lab.com/source/testing/test.govlab/quality/core/selectors/catalog.selector.test.ts.md).

## Contained in

- [test.govlab/quality/core/selectors](https://banes-lab.com/anatomy/testing/folder-testing-test-govlab-quality-core-selectors.md)

## Source

```typescript
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);
});
```
