# test.govlab/context/core/factories/lexicon.factory.test.ts

> 25 lines of code and 0 definitions.

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

Listed in [test.govlab/context/core/factories](https://banes-lab.com/api/source/testing/test.govlab/context/core/factories.md), after [test.govlab/context/core/factories/layer.factory.test.ts](https://banes-lab.com/source/testing/test.govlab/context/core/factories/layer.factory.test.ts.md) and before [test.govlab/context/core/factories/ontology.factory.test.ts](https://banes-lab.com/source/testing/test.govlab/context/core/factories/ontology.factory.test.ts.md).

## Contained in

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

## Source

```typescript
import { LEX_FACE, createLexicon } from "@govlab/context";
import assert from "node:assert/strict";
import { test } from "vitest";

test("a term without its own enforcedBy takes its category's, and its own wins where it has one", () => {
    const lex = createLexicon({
        data: [
            {
                category: "planted",
                enforcedBy: ["the category gate"],
                records: [
                    { definition: "A formal definition of a planted tag.", kind: "artifact", name: "Planted Tag" },
                    {
                        definition: "A formal definition of an owned tag.",
                        enforcedBy: ["its own gate"],
                        kind: "artifact",
                        name: "Owned Tag",
                    },
                ],
            },
        ],
    });
    assert.deepEqual(lex.get("planted-tag")?.enforcedBy, ["the category gate"]);
    assert.deepEqual(lex.get("owned-tag")?.enforcedBy, ["its own gate"]);
    assert.equal(LEX_FACE.name, "lexicon");
});
```
