Problem
scripts/validate-fixtures.mjs is only ever exercised end-to-end against the real, currently-valid destinations.json/scores.json — there is no test that actually proves each of its error branches (invalid label, missing score entry, out-of-range score, orphaned score entry) fires correctly, and no regression protection if a future refactor accidentally breaks one of those checks while keeping the "happy path" green.
Requirements
- Refactor
scripts/validate-fixtures.mjs minimally so its validation logic is importable as a pure function (e.g. export function validate(destinations, scores) returning the errors array) separate from the file-reading/process.exit CLI wrapper — without changing its externally observed CLI behavior.
- Add a test suite using Node's built-in
node:test + node:assert (no new test-framework dependency needed) covering: valid input passes with zero errors; each individual error condition fires with the expected message when triggered in isolation; multiple simultaneous errors are all reported (not just the first).
- Add
npm test and wire it into .github/workflows/ci.yml.
Acceptance Criteria
npm test passes and demonstrably covers every errors.push(...) call site in the validator (one test per branch, minimum).
- The CLI wrapper's actual behavior (reads real files, exits 1 on failure, prints the same messages) is unchanged — verify by running
npm run validate against current fixtures.
Part of the Gryd-lock organization. This repo supplies the labelled testnet fixtures and stub scores consumed by grydlock-oracle-adapter's StubOracle and evaluated end-to-end by grydlock-research.
Problem
scripts/validate-fixtures.mjsis only ever exercised end-to-end against the real, currently-validdestinations.json/scores.json— there is no test that actually proves each of its error branches (invalid label, missing score entry, out-of-range score, orphaned score entry) fires correctly, and no regression protection if a future refactor accidentally breaks one of those checks while keeping the "happy path" green.Requirements
scripts/validate-fixtures.mjsminimally so its validation logic is importable as a pure function (e.g.export function validate(destinations, scores)returning theerrorsarray) separate from the file-reading/process.exitCLI wrapper — without changing its externally observed CLI behavior.node:test+node:assert(no new test-framework dependency needed) covering: valid input passes with zero errors; each individual error condition fires with the expected message when triggered in isolation; multiple simultaneous errors are all reported (not just the first).npm testand wire it into.github/workflows/ci.yml.Acceptance Criteria
npm testpasses and demonstrably covers everyerrors.push(...)call site in the validator (one test per branch, minimum).npm run validateagainst current fixtures.Part of the Gryd-lock organization. This repo supplies the labelled testnet fixtures and stub scores consumed by
grydlock-oracle-adapter'sStubOracleand evaluated end-to-end bygrydlock-research.