test(remote-connection): extract shared fixtures from the connection suite - #2252
Merged
Conversation
…suite Second pass after #2243: the connect --force family, the proxy open/install pair, and the provider-allocation, persistence-failure, and proxy-disconnect scenarios build their setup from writeReplacedProfiles, seedPreviousConnection, forceConnectFlags, recordedLeaseRelease, and recordedLeaseAllocate. Titles and assertion lines are unchanged; 50 tests before and after.
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 |
|
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
Second pass after #2243 on
src/__tests__/remote-connection.test.ts. Theconnect --forcefamily, the proxyopen/installpair, and the provider-allocation, persistence-failure, and proxy-disconnect scenarios now take their setup from named exports in the siblingremote-connection.fixtures.ts:writeReplacedProfiles(the old/new profile files),seedPreviousConnection(thelease-old/run-oldconnection a forced connect replaces),forceConnectFlags, andrecordedLeaseRelease/recordedLeaseAllocate(stubs that keep the last request they received). Every test keeps its title and its own assertion lines; none is deleted, merged, or parametrized. No behavior change for operators or clients.jscpd (
--min-tokens 80 --min-lines 8): 211 -> 44 duplicated lines, 10 -> 3 clones. The remaining three are the shared assertion tails of the--forcescenarios, which stay in the tests by design. Test file 2,696 -> 2,413 lines; fixtures 160 -> 282.Validation
npx vitest run --project unit-core src/__tests__/remote-connection.test.ts: 50/50 before and after (numTotalTests50 = 50);assert.calls 213 = 213.pnpm check:quickandpnpm check:fallow: clean.connection-runtime.ts, replacedreturn previousConfigStillSpeaksForPreviousEndpoint(previous, profile.daemonBaseUrl)withreturn true;vitest -t "re-pointed config path"->× connect --force does not treat a re-pointed config path's token as the previous endpoint's own/AssertionError: Expected values to be strictly equal. Restored.-xinbuildProxyDeviceKey;vitest -t "resolves device key before allocating lease"->Expected: "ios:mobile:SIM-001"/Received: "ios:mobile:SIM-001-x". Restored.Tradeoffs / follow-ups