# test.govlab/quality/core/registries/section.registry.test.ts

> 15 lines of code and 0 definitions.

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

Listed in [test.govlab/quality/core/registries](https://banes-lab.com/api/source/testing/test.govlab/quality/core/registries.md), after [test.govlab/quality/core/registries/producer.registry.test.ts](https://banes-lab.com/source/testing/test.govlab/quality/core/registries/producer.registry.test.ts.md) and before [test.govlab/quality/core/registries/step.registry.test.ts](https://banes-lab.com/source/testing/test.govlab/quality/core/registries/step.registry.test.ts.md).

## Contained in

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

## Source

```typescript
import {
    defineConfigSection,
    registeredSections,
    validateConfig,
} from "@govlab/quality/core/registries/section.registry.ts";
import { expect, test } from "vitest";

test("a defined section validates its own key", () => {
    const section = defineConfigSection({
        key: "zzProbe",
        validate: (value) => (typeof value === "string" ? [] : ["zzProbe must be a string"]),
    });
    expect(registeredSections()).toContain(section);
    expect(validateConfig({ zzProbe: 1 }).some((error) => error.includes("zzProbe"))).toBe(true);
    expect(validateConfig({ zzProbe: "ok" }).some((error) => error.includes("zzProbe"))).toBe(false);
});
```
