Repository navigation
Share one token-link builder across tests #470
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
Six test files each build approved token links with their own helper. Replace them with one makeTokenLink in src/__tests__/test-helpers.ts, beside makePhraseLink.
Today
| File | Builder | Default id | Uses |
|---|---|---|---|
analysis-repository-conformance.ts (#469) |
tokenLink(id, analysisId, tokenRef, surfaceText) |
none; the caller passes it | 4 |
types/type-guards.test.ts |
tokenLink(analysisId, status?, tokenRef?) |
ref:analysis:status |
10 |
utils/analysis-book.test.ts |
mkTokenLink(analysisId, tokenRef) |
ref:analysis |
12 |
utils/project-analysis-summary.test.ts |
mkTokenLink(analysisId, tokenRef) |
ref:analysis |
11 |
utils/reanchor-analysis.test.ts |
makeTokenLink(tokenRef, surfaceText, analysisId?) |
ref:analysis |
76 |
utils/analysis-violations.test.ts |
linkTo(analysisId, tokenRef, id?) |
tl-ref |
6 |
Watch for
- Unique default ids.
type-guards.test.tsputs the status in the id, so two links on one token and payload stay distinct. The shared default must keep that. - Explicit ids.
analysis-violations.test.tspasses the same id twice to triggerduplicateLinkId, so callers must still be able to set the id. - Surface text. Some builders default it to the token ref;
reanchor-analysis.test.tsneeds a real one for drift detection. Default it, but allow an override.
As the data layer plan lands
- Sequencing. Blocked by 1e ([1e] Store project summaries for the picker #434); blocks 3b ([3b] Add apply with inverse capture and per-session undo #441). 3b to 3i ([3b] Add apply with inverse capture and per-session undo #441 to [3i] Add catalog-wide edits, wipes and previewRemovals #448) add parity and conformance tests that build many links, and they start on the shared builder.
- 1e ([1e] Store project summaries for the picker #434). Rewrites the project summaries, so
project-analysis-summary.test.tsgets consolidated as 1e leaves it. - 3b ([3b] Add apply with inverse capture and per-session undo #441).
ChangeSets are keyed by record type and id, so fixture ids must be unique and stable. - 3j ([3j] Re-anchor every linked book in the host #449). Its done-when reuses the drift cases in
reanchor-analysis.test.ts, the biggest user here, for the host reanchor pass. Consolidating first lets those cases move without their own builder. - 4c ([4c] Delete the WebView write path #455). Deletes the WebView reanchor passes, so
reanchor-analysis.test.tsgoes or moves with them. Whatever remains should already use the shared builder. - Segment links may have the same duplication. Check it in the same pass, and add a
makeSegmentLinkif so.
Done when
The test files build token links only through makeTokenLink, and the suite passes unchanged.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity
Share one token-link builder across tests (#470) (#499)