Repository navigation
Share one token-link builder across tests (#470) - #499
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
📝 Walkthrough
Merge Risk: 🔵 Low · up to
|
imnasnainaec
left a comment
There was a problem hiding this comment.
@imnasnainaec reviewed 7 files and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on alex-rawlings-yyc).
Closes #470.
Summary
The six test files that each built approved token links with their own helper now share
makeTokenLink(analysisId, tokenRef, { surfaceText?, status?, id? })intest-helpers.ts, besidemakePhraseLink.[tokenRef, analysisId, status], so links on one token and payload that differ only in status stay distinct, and colons inside a token ref can't make two ids collide.{ ...link, status }spreads inreanchor-analysis.test.tspass it instead, so the default id tracks it.type-guards.test.tsbuild through the helper and thendelete link.id, as the phrase-link test beside them does.Evidence
tscclean.Decisions with a strong alternative
surfaceText, mirroringmakePhraseLink'ssurfaceTexts. Why not: overriding onlystatusoridwould then need anundefinedplaceholder.makeSegmentLink. Onlyanalysis-book.test.tshas a segment-link builder; the other segment links are one-off literals. Alternative: add one for symmetry. Why not: there is nothing to share yet.analysisSlice.test.ts,AnalysisStore.test.tsx,TokenChip.suggestions.test.tsx) stay as they are. Alternative: migrate them too. Why not: they are literals rather than helpers, and the diff would grow several times over.Merge Danger
Door: two-way
Tests only. 3d (#443) adds one more local
tokenLinkinapprovalRule.test.ts, which should fold into the shared builder when that branch rebases.Blast Radius:
test-helpers.tsand the six migrated test files🤖 Generated with Claude Code
This change is
Summary by CodeRabbit