test(daemon): extract shared fixtures from the snapshot handler suite - #2254
Merged
Conversation
The snapshot handler suite repeated its setup inline: the device literals, the token-fixed daemon request, the bind-counting runtime, the Android capture reply, the flat text rows, the freshness-window session with its baseline signatures, and the location-required and Battery surfaces. Those move to the sibling fixtures module (renamed from snapshot-handler-fixture.ts to the *.fixtures.ts convention) as named exports; every scenario keeps its title, its inputs, and its own assertions. jscpd (--min-tokens 80 --min-lines 8): 536 -> 58 duplicated lines in snapshot-handler.test.ts (the two remaining clones are assertion blocks). Test count 41 -> 41, expect( calls 162 -> 162.
Size Report
npm unpacked components
Startup median (7 runs, lower is better):
Top changed chunks: no changes in the largest emitted chunks. Top changed packed filesNo changed packed files. |
Member
Author
|
READY at Test-only fixture extraction preserves the 41 snapshot-handler scenarios and their assertion ownership; production routing is unchanged. Exact-head CI is clean, including Coverage, Integration Tests, Repo Guards, and Android/Linux/macOS smoke. Size is unchanged for npm unpacked/bundled output (tarball metadata +7 B only). No linked dependencies or unresolved review findings. |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
snapshot-handler.test.tsrepeated its setup inline: the device literals, the token-fixed daemon request, the bind-counting runtime, the Android capture reply, the text rows, the freshness-window session, and the location-required / Battery surfaces. Those move tosnapshot-handler.fixtures.ts(the existingsnapshot-handler-fixture.ts, renamed to the*.fixtures.tsconvention) as named exports. Every scenario keeps its title, its inputs, and its ownexpectlines.expect(calls 162 -> 162.--min-tokens 80 --min-lines 8): 536 -> 58 duplicated lines; the two remaining clones are assertion blocks.Scope: the 1,000-line gross-diff budget fits only the largest file (this diff is 981 lines).
react-native.test.ts(909 duplicated lines) andsession-relaunch-close.test.ts(511) are left for follow-up PRs.Validation
npx vitest run --project unit-core src/daemon/handlers/__tests__/snapshot-handler.test.ts --reporter=json: 41/41 before and after.pnpm check:quick,scripts/layering/check.ts,pnpm check:fallow,test-file-size-ratchetandfallow-fixture-policygate tests: green.selector-wait.ts:273includeHiddenContentHints: false -> true;wait selector polling skips hidden-content hint derivation on every poll (#1270)fails:AssertionError: expected true to be false. Restored.makeAndroidFreshnessSessionrouteComparable: true -> false;snapshot warns when Android freshness retries still return the previous routefails:AssertionError: expected undefined to deeply equal [ StringContaining{…} ]. Restored.Full affected gate: pending (serialized gate stage will append the result)
Tradeoffs / follow-ups
chore(gates)commit.