# tests/core/predicates/schema.predicate.test.ts

> 26 lines of code and 0 definitions.

Tree: Coordination tree
Language: typescript
Canonical: https://banes-lab.com/anatomy/coordination#file-coordination-tests-core-predicates-schema-predicate-test-ts
Source text: https://banes-lab.com/assets/sources/source.69ba5e8a352c04aaaed3f36f8d7c1d303780e4a710b549112af03cf28d0222b3.generated.txt

## Source

```typescript
import { describe, it } from "node:test";
import { hasFields, isCorpusMoveList, isObject, isStringMap } from "../../../tools/core/predicates/schema.predicate.ts";
import assert from "node:assert/strict";

describe("isObject and isStringMap", () => {
    it("accepts a plain object and refuses null and arrays; a string map holds only strings", () => {
        assert.equal(isObject({}), true);
        assert.equal(isObject(null), false);
        assert.equal(isObject([]), false);
        assert.equal(isStringMap({ a: "x" }), true);
        assert.equal(isStringMap({ a: 1 }), false);
    });
});

describe("hasFields", () => {
    it("requires every named field to be present", () => {
        assert.equal(hasFields({ a: 1, b: 2 }, ["a", "b"]), true);
        assert.equal(hasFields({ a: 1 }, ["a", "b"]), false);
    });
});

describe("isCorpusMoveList", () => {
    it("accepts moves carrying their string fields and refuses anything else", () => {
        const move = { facet: "f", from: "a", key: "k", to: "b", variant: null };
        assert.equal(isCorpusMoveList([move]), true);
        assert.equal(isCorpusMoveList([{ ...move, from: 1 }]), false);
        assert.equal(isCorpusMoveList(move), false);
    });
});
```
