# test.govlab/context/configuration/schemas/grammar.schema.test.ts

> 16 lines of code and 0 definitions.

Tree: Codebase Testing
Language: typescript
Canonical: https://banes-lab.com/anatomy/testing#file-testing-test-govlab-context-configuration-schemas-grammar-schema-test-ts
Source text: https://banes-lab.com/source/testing/test.govlab/context/configuration/schemas/grammar.schema.test.ts.txt

Listed in [test.govlab/context/configuration/schemas](https://banes-lab.com/api/source/testing/test.govlab/context/configuration/schemas.md).

## Contained in

- [test.govlab/context/configuration/schemas](https://banes-lab.com/anatomy/testing/folder-testing-test-govlab-context-configuration-schemas.md)

## Source

```typescript
import { PAG_KINDS, createPagGrammar } from "@govlab/context";
import { PAG_SCHEMA } from "@govlab/context/configuration/schemas/grammar.schema.ts";
import assert from "node:assert/strict";
import { recordDefects } from "@govlab/context/core/validators/field.validator.ts";
import { test } from "vitest";

test("the keyword schema passes a bundled keyword and refuses one missing its meaning", () => {
    const schema = PAG_SCHEMA.get(PAG_KINDS.keyword);
    assert.ok(schema, "the grammar schema declares the keyword kind");
    const [keyword] = createPagGrammar().keywords();
    assert.ok(keyword, "the grammar holds a keyword");
    const [primary, ...further] = keyword.roles;
    const raw = { keyword: keyword.keyword, ...primary, ...(further.length > 0 ? { roles: further } : {}) };
    assert.deepEqual(recordDefects(schema, raw), []);
    const meaningless = Object.fromEntries(Object.entries(raw).filter(([key]) => key !== "meaning"));
    assert.deepEqual(recordDefects(schema, meaningless), ["has no meaning, which its kind requires"]);
});
```
