# test.govlab/pipeline/core/factories/validation.factory.test.ts

> 24 lines of code and 0 definitions.

Tree: Codebase Testing
Language: typescript
Canonical: https://banes-lab.com/anatomy/testing#file-testing-test-govlab-pipeline-core-factories-validation-factory-test-ts
Source text: https://banes-lab.com/source/testing/test.govlab/pipeline/core/factories/validation.factory.test.ts.txt

Listed in [test.govlab/pipeline/core/factories](https://banes-lab.com/api/source/testing/test.govlab/pipeline/core/factories.md), after [test.govlab/pipeline/core/factories/stage.fixture.ts](https://banes-lab.com/source/testing/test.govlab/pipeline/core/factories/stage.fixture.ts.md).

## Contained in

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

## Source

```typescript
import { describe, expect, it } from "vitest";
import { scopeFor, stepLabels } from "./stage.fixture.ts";
import { validationStage } from "@govlab/pipeline/core/factories/validation.factory.ts";

describe("validationStage", () => {
    it("adds the application's validators only when the application is in scope", () => {
        const withApp = validationStage(scopeFor(["app"], false));
        const without = validationStage(scopeFor(["content"], false));
        expect(stepLabels(withApp)).toContain("Validate content leaks");
        expect(stepLabels(without)).toStrictEqual(["Validate spelling"]);
    });

    it("checks the spelling of every scoped member without rewriting, and adds no check with no member", () => {
        const [spelling] = validationStage(scopeFor(["content"], false)).steps;
        const run = spelling !== undefined && "run" in spelling ? spelling.run : "";
        expect(run).toContain("word.entrypoint.ts --check --root ");
        expect(run).toContain("--ext .md");
        const unscoped = validationStage(scopeFor([], false));
        expect(stepLabels(unscoped)).toStrictEqual([]);
    });

    it("runs the validators and the document gate on a full run", () => {
        const labels = stepLabels(validationStage(scopeFor([], true)));
        expect(labels).toContain("Validate config");
        expect(labels).toContain("Validate documents");
    });
});
```
