# tests/core/readers/template.reader.test.ts

> 42 lines of code and 0 definitions.

Tree: Coordination tree
Language: typescript
Canonical: https://banes-lab.com/anatomy/coordination#file-coordination-tests-core-readers-template-reader-test-ts
Source text: https://banes-lab.com/assets/sources/source.a9678867ec38b7cfb7133a5290f2f0020e8a6243e6926eb9ac87479ac2e39299.generated.txt

## Source

```typescript
import { describe, it } from "node:test";
import { readRowMarkers, readTemplateContract } from "../../../tools/core/readers/template.reader.ts";
import assert from "node:assert/strict";

const TEMPLATE = [
    'SET substrate_cycle = ["seed", "grow"] then "ignored"',
    'SET ripple_dimensions = ["cost", "risk", "open',
    "SET confidence_threshold =  0.8 or so",
    "SET confidence_threshold = 0.1",
    "graph_4d: { axis_d: [], axis_s: [], note } trailing: x",
].join("\n");

describe("readTemplateContract", () => {
    it("reads the stages, the closed ripple items, the first threshold and the graph's axes", () => {
        assert.deepEqual(readTemplateContract(TEMPLATE), {
            confidenceThreshold: 0.8,
            dependencyAxes: ["axis_d", "axis_s"],
            genesisStages: ["seed", "grow"],
            rippleDimensions: ["cost", "risk"],
        });
    });

    it("reads zero and empty lists from a template that assigns nothing", () => {
        assert.deepEqual(readTemplateContract("prose"), {
            confidenceThreshold: 0,
            dependencyAxes: [],
            genesisStages: [],
            rippleDimensions: [],
        });
    });
});

describe("readRowMarkers", () => {
    it("reads the row markers in the rendered-as column of the first table that has one", () => {
        const source = [
            "| field | rendered as |",
            "|---|---|",
            "| a | `*A:*` |",
            "| b | plain |",
            "",
            "| c | `*C:*` |",
        ].join("\n");
        assert.deepEqual(readRowMarkers(source), ["*A:*"]);
        assert.deepEqual(readRowMarkers("| no | table |"), []);
    });
});
```
