test(harness): continue bounded risk-reduction with shared service harness
This commit is contained in:
@@ -2076,3 +2076,36 @@ Validation:
|
||||
Follow-ups:
|
||||
|
||||
- Optional consolidation: extract shared phase6/phase7 VM loader helpers into a single test utility to reduce duplication.
|
||||
|
||||
---
|
||||
|
||||
### CL-059: TASK22260 next slice — shared service harness extraction (continued bounded risk-reduction)
|
||||
|
||||
date: 2026-03-25
|
||||
author: Cline
|
||||
scope: `tests/{serviceHarness,phase6/service-behaviour,phase7/service-behaviour}.cjs`
|
||||
type: change
|
||||
rationale: Continue the bounded risk-reduction stream by removing duplicated test harness infrastructure across phase6/phase7 service behavioural suites and centralizing client-wrapper-compatible mocks.
|
||||
impact: Reduces test harness drift risk and keeps client-wrapper migration verification stable across multiple suites, without runtime code changes.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Added shared helper module `tests/serviceHarness.cjs` with reusable:
|
||||
- `createAxiosMock`
|
||||
- `createLoggerMock`
|
||||
- `createAxiosError`
|
||||
- `loadServiceModule` (with default `getJson`/`requestJson`/`buildHashedQueryUrl` injections)
|
||||
- `normalize`
|
||||
- Refactored `tests/phase6/service-behaviour.test.cjs` to import shared harness utilities and remove duplicated local harness implementation.
|
||||
- Refactored `tests/phase7/service-behaviour.test.cjs` to import shared harness utilities and remove duplicated local harness implementation.
|
||||
|
||||
Validation:
|
||||
|
||||
- `node tests/phase6/service-behaviour.test.cjs` -> pass (8/8)
|
||||
- `node tests/phase7/service-behaviour.test.cjs` -> pass (12/12)
|
||||
- `npm run lint` -> warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors)
|
||||
|
||||
Follow-ups:
|
||||
|
||||
- Optional next bounded risk-reduction slice: evaluate whether other legacy service test suites can adopt `tests/serviceHarness.cjs` to standardize migration-era service mocking behavior.
|
||||
|
||||
Reference in New Issue
Block a user