Skip to content

Add a unit test suite for scripts/validate-fixtures.mjs covering every error branch #34

Description

@knytcomics-ui

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26advancedRequires deep domain knowledge or cross-repo contextarea: testingTest infrastructureenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions