@demystify/tools-testkit
v0.1.0
Published
Test harness for Demystify tool engines — I/O golden cases, round-trip and property checks, against the tool's zod schema. The student-lane rubric, as code.
Maintainers
Readme
@demystify/tools-testkit
The test harness behind every Demystify tool engine — the student-lane rubric as code.
Framework-agnostic (no test-runner dependency): each helper runs cases and returns a
structured Report; call assertReport(report) inside your test to fail on any mismatch.
import { z } from "zod";
import { runSchemaCases, roundTrip, assertReport } from "@demystify/tools-testkit";
// Calculator/parser goldens, validated against the tool's zod schema first:
assertReport(runSchemaCases(GstInput, gstCalculate, [
{ name: "1000 @ 18% exclusive", input: { amountPaise: 100000, rate: 18 },
expected: { cgstPaise: 9000, sgstPaise: 9000, totalPaise: 118000, /* … */ } },
]));
// Converters — decode(encode(x)) === x:
assertReport(roundTrip(toYaml, fromYaml, sampleDocs));runIoCases(fn, cases)— named input→output goldens.runSchemaCases(schema, fn, cases)— validates input against the zod schema first.roundTrip(encode, decode, samples)— converter round-trips.property(predicate, samples)— property checks.deepEqual,assertReport— structural equality + a readable throw.
Status
Pre-1.0, versioned but not yet published — see the repo's docs/verification/user-actions.md.
