testing: migrate adapter.test.ts to stub HttpClient; delete live-contract dups (comms-e5vm.3) - #17
Merged
Merged
Conversation
…ract dups (comms-e5vm.3) Tier-2 migration following the comms-e5vm.2 proof. Move the adapter-internal unit tests off the real Bun.serve + FetchHttpClient realm onto the owned-fake stub HttpClient via effectTest — deterministic, socket-free. These are the request-shape and error-mapping tests (params, narrow JSON, auth headers, captured-call counts, paths, ZulipApiError → DirectoryError|Publisher Error cause preservation) that the substrate-agnostic live contract never asserts, so this is migration, not deletion: identity acquire/release, the directory filters + presence mapping, publisher wire-shape + pre-flight, history narrow/range/sender-kind, inbox.replay + subscribe/unsubscribe, the minter-creds routing block, and reconcileMinterSubscriptions. The brand type-proofs stay as plain compile-time `test` (no socket, no runtime). Delete three pure-behavioural duplicates of the live contract (return-value-only assertions with exact contract twins): acquire-different-name-rejects and both resolve known/unknown cases. The human-kind parse stays covered by the migrated listHumans test. No startTestRealm survives in this file; the genuine real-socket scope-close teardown is the Tier-3 residue tracked by comms-4lz5.
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.
Tier-2 migration following the merged comms-e5vm.2 proof (#12). Moves the
adapter-internal unit tests in
packages/zulip/adapter.test.tsoff the realBun.serve+FetchHttpClientrealm onto the owned-fake stub HttpClientvia
effectTest— deterministic, socket-free.What moved
These are the request-shape and error-mapping tests — captured-request
params, narrow JSON, auth headers, call counts, paths, and
ZulipApiError → DirectoryError|PublisherErrorcause preservation — which the substrate-agnosticlive contract (
contract.ts) deliberately never asserts. So this is migration,not deletion:
/streamspre-flight ordering, UnknownChannel, PublisherError cause, edit/react/unreactThe
attachmentReference/UserUploadPathbrand type-proofs stay as plaincompile-time
test(no socket, no runtime).What was deleted
Three pure-behavioural duplicates of the live contract — return-value-only
assertions with exact contract twins:
identity.acquire with a different name on a bound adapter rejectsidentity.resolve returns Identity for a known full_nameidentity.resolve returns undefined for an unknown full_nameThe human-kind parse stays covered by the migrated
listHumanstest.Scope notes
startTestRealmsurvives in this file. The genuine real-socketscope-close/long-poll teardown is the Tier-3 residue tracked separately
(comms-4lz5); the reconnect/long-poll logic already moved to
adapter-events.test.tsin .2.bun run checkgreen in the nix dev shell.