plan/react-rewrite #1
@@ -0,0 +1,81 @@
|
||||
# Phase 2G — Parity Harnesses
|
||||
|
||||
> **Parent:** `2026-04-14-phase-2-online-board-master.md` (sub-plan 2G)
|
||||
> **Depends on:** 2B (URL serializer), 2F (SEO builders)
|
||||
|
||||
## Goal
|
||||
|
||||
Build generic, reusable parity harnesses for URL serialization and SEO output.
|
||||
Register the Online Board feature against both harnesses. Phase 3+ features
|
||||
will register their own serializers into the same framework.
|
||||
|
||||
## Deliverables
|
||||
|
||||
1. **URL parity harness** (`tests/parity/url/harness.ts`) — generic framework
|
||||
for table-driven + `fast-check` property-based URL roundtrip tests.
|
||||
2. **URL parity test** (`tests/parity/url/onlineboard.test.ts`) — Online Board
|
||||
registered against the harness, testing against fixture corpus.
|
||||
3. **URL fixture corpus** (`tests/fixtures/phase-2/url-corpus/onlineboard.json`)
|
||||
— ~20 representative URLs covering all 6 route types.
|
||||
4. **SEO parity harness** (`tests/parity/seo/harness.ts`) — generic framework
|
||||
for testing SEO builder output shape/completeness.
|
||||
5. **SEO parity test** (`tests/parity/seo/onlineboard.test.ts`) — Online Board
|
||||
SEO builders registered against the harness.
|
||||
6. **`fast-check`** installed as a dev dependency.
|
||||
|
||||
## Task list
|
||||
|
||||
### T1 — Install `fast-check`
|
||||
|
||||
- `pnpm add -D fast-check`
|
||||
- Verify: `pnpm typecheck`
|
||||
|
||||
### T2 — Create URL fixture corpus
|
||||
|
||||
- File: `tests/fixtures/phase-2/url-corpus/onlineboard.json`
|
||||
- ~20 entries covering: start, flight (with/without suffix, 3-char carrier),
|
||||
departure (with/without time range), arrival (with/without time range),
|
||||
route (with/without time range), details (with/without suffix).
|
||||
- Each entry: `{ url: string, expected: OnlineBoardParams }`.
|
||||
|
||||
### T3 — URL parity harness
|
||||
|
||||
- File: `tests/parity/url/harness.ts`
|
||||
- Exports `UrlParityConfig<T>` interface and `defineUrlParityTests<T>()`.
|
||||
- Table-driven tests: reads fixture file, for each entry asserts
|
||||
`parse(url) === expected` and `build(expected) === url`.
|
||||
- Fuzz tests: uses `fast-check` arbitrary to generate random params,
|
||||
asserts `parse(build(params)) deep-equals params` (roundtrip property).
|
||||
|
||||
### T4 — Register Online Board URL parity
|
||||
|
||||
- File: `tests/parity/url/onlineboard.test.ts`
|
||||
- Imports harness + URL serializer + fixtures.
|
||||
- Defines `fc.Arbitrary<OnlineBoardParams>` covering all 6 discriminants.
|
||||
- Calls `defineUrlParityTests(config)`.
|
||||
|
||||
### T5 — SEO parity harness
|
||||
|
||||
- File: `tests/parity/seo/harness.ts`
|
||||
- Exports `SeoParityConfig` interface and `defineSeoParityTests()`.
|
||||
- Tests: for each registered SEO builder call, asserts output has all required
|
||||
fields (title, description, canonical, hreflang with 10 entries, OG tags).
|
||||
|
||||
### T6 — Register Online Board SEO parity
|
||||
|
||||
- File: `tests/parity/seo/onlineboard.test.ts`
|
||||
- Registers all 6 Online Board SEO builders.
|
||||
- Asserts shape correctness for each route type x 2 languages (ru, en).
|
||||
|
||||
### T7 — Verification
|
||||
|
||||
- `pnpm typecheck && pnpm lint && pnpm test`
|
||||
- All new tests pass. All existing tests still pass.
|
||||
|
||||
## Exit gates
|
||||
|
||||
- URL parity: 100% of fixture corpus passes roundtrip.
|
||||
- `fast-check` fuzz finds no roundtrip asymmetry (100 iterations default).
|
||||
- SEO parity: all 6 route types produce complete SeoHeadProps.
|
||||
- `pnpm typecheck`, `pnpm lint`, `pnpm test` green.
|
||||
- No `any` types in harness code.
|
||||
Reference in New Issue
Block a user