feat(cli): convert e2e-check scenarios to snapshot fixture tests #68

Merged
xingyue merged 3 commits from fix/66-e2e-snapshot-tests into main 2026-05-31 11:43:32 +00:00
Owner

What

Converts all 45 e2e-check.yaml workflow scenarios (plus one derived test) into 46 fast, deterministic bun test snapshot fixture tests in packages/cli-json-cas/src/e2e.test.ts.

Why

Replaces the slow workflow-driven e2e checks with a proper test suite that runs in CI via bun test, giving faster feedback and a repeatable test contract.

Changes

  • packages/cli-json-cas/src/e2e.test.ts — new file with 46 tests across 7 describe blocks (CAS Core, Schema Validation, Variable System, Template System, Render, GC, Edge Cases)
  • packages/cli-json-cas/src/__snapshots__/e2e.test.ts.snap — auto-generated deterministic snapshots (33 entries)

Key design decisions:

  • Shared beforeAll temp store so hashes computed in Phase 1 are reusable in later phases
  • stripVolatile() helper removes timestamp/created/updated fields before snapshotting
  • Test 2.1 uses toContain("Validation failed") instead of snapshotting the machine-specific tmp path
  • Phase 6 GC asserts structural shape (total >= reachable, all numbers) rather than exact counts

Ref

Fixes #66

## What Converts all 45 e2e-check.yaml workflow scenarios (plus one derived test) into 46 fast, deterministic `bun test` snapshot fixture tests in `packages/cli-json-cas/src/e2e.test.ts`. ## Why Replaces the slow workflow-driven e2e checks with a proper test suite that runs in CI via `bun test`, giving faster feedback and a repeatable test contract. ## Changes - **`packages/cli-json-cas/src/e2e.test.ts`** — new file with 46 tests across 7 `describe` blocks (CAS Core, Schema Validation, Variable System, Template System, Render, GC, Edge Cases) - **`packages/cli-json-cas/src/__snapshots__/e2e.test.ts.snap`** — auto-generated deterministic snapshots (33 entries) Key design decisions: - Shared `beforeAll` temp store so hashes computed in Phase 1 are reusable in later phases - `stripVolatile()` helper removes `timestamp`/`created`/`updated` fields before snapshotting - Test 2.1 uses `toContain("Validation failed")` instead of snapshotting the machine-specific tmp path - Phase 6 GC asserts structural shape (`total >= reachable`, all numbers) rather than exact counts ## Ref Fixes #66
xingyue added 3 commits 2026-05-31 11:32:11 +00:00
Convert 46 e2e-check workflow scenarios to fast bun test snapshot tests.
7 describe phases share a single mkdtempSync store; hashes are deterministic
so cross-phase data dependencies work without re-creating data.

Closes #66

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
- Strip volatile fields (timestamp, created, updated) from JSON before
  snapshotting using a stripVolatile helper
- Remove toMatchSnapshot() from test 2.1 to avoid embedding machine-
  specific tmp paths in the snapshot; use toContain assertions instead
- Replace GC count snapshot with structural shape assertions so counts
  don't need to match exact phase-history state

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
xingyue merged commit b93d7b229a into main 2026-05-31 11:43:32 +00:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/json-cas#68