Part of #1412 (Track A).
Context
No property-based tests exist. The highest-value targets are pure parse/print and geometry kernels that agents touch constantly and that currently rely on hand-picked examples.
Deliverables
- Add
fast-check as a dev dependency; add input generators (selectors, refs, rects, .ad lines) to src/__tests__/test-utils/ behind the existing barrel.
- First properties, each in the owning module's test file:
- Selector grammar: parse→serialize→parse idempotence, including quote/apostrophe hazards (
src/selectors/parse.ts).
- Pinned-ref grammar:
@eN~sM split/join round-trip (splitRefGenerationSuffix).
buildGesturePlan: for any supported gesture and any viewport, every synthesized point stays in bounds (replaces the two hand-pinned compact viewports in test/integration/smoke-ios-simulator-coverage.test.ts as the general guarantee; keep those as examples).
.ad script parser: parse→serialize→parse stability for generated valid scripts (src/replay/script.ts).
- Snapshot diff:
diff(a,a) is empty; summary counts always equal rendered line counts (src/snapshot/snapshot-diff.ts).
- One short section in
docs/agents/testing.md: "pure parser or geometry change → extend a property, not another example."
Acceptance
- Properties run in
unit-core within the slow-test budget (bound numRuns).
- Failure output includes the shrunk counterexample.
pnpm check:affected --base origin/main --run green.
Out of scope
Fuzzing the CLI arg surface (separate fuzz-lane issue); exec/subprocess layer.
Part of #1412 (Track A).
Context
No property-based tests exist. The highest-value targets are pure parse/print and geometry kernels that agents touch constantly and that currently rely on hand-picked examples.
Deliverables
fast-checkas a dev dependency; add input generators (selectors, refs, rects, .ad lines) tosrc/__tests__/test-utils/behind the existing barrel.src/selectors/parse.ts).@eN~sMsplit/join round-trip (splitRefGenerationSuffix).buildGesturePlan: for any supported gesture and any viewport, every synthesized point stays in bounds (replaces the two hand-pinned compact viewports intest/integration/smoke-ios-simulator-coverage.test.tsas the general guarantee; keep those as examples)..adscript parser: parse→serialize→parse stability for generated valid scripts (src/replay/script.ts).diff(a,a)is empty; summary counts always equal rendered line counts (src/snapshot/snapshot-diff.ts).docs/agents/testing.md: "pure parser or geometry change → extend a property, not another example."Acceptance
unit-corewithin the slow-test budget (boundnumRuns).pnpm check:affected --base origin/main --rungreen.Out of scope
Fuzzing the CLI arg surface (separate fuzz-lane issue); exec/subprocess layer.