Repository navigation
test(collab): complete nanoid mock in #344 gateway spec (fix CI) - #34
Merged
Merged
Conversation
…c (customAlphabet) The `collaboration-gateway-redis.spec.ts` (docmost#344) mocked `nanoid` as `{ nanoid }` only, but the gateway's unmocked import graph reaches `common/helpers/nanoid.utils.ts`, which calls `customAlphabet(...)` at module top level. Under the mock that export was undefined, so the suite threw `TypeError: customAlphabet is not a function` at load — non-deterministically (load-order dependent: green locally, red in the multi-worker CI `authz compat` job). Provide `customAlphabet` (a generator-returning function) in the mock so the spec is hermetic regardless of which module in the graph loads nanoid.utils first. Test-only; no production code change. Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.
Follow-up to #33. The
#344gateway spec (collaboration-gateway-redis.spec.ts) mockednanoidas{ nanoid }only, but the gateway's unmocked import graph reachescommon/helpers/nanoid.utils.ts, which callscustomAlphabet(...)at module top level. Under the incomplete mock that export isundefined, so the suite threwTypeError: customAlphabet is not a functionat load — non-deterministically (jest module load-order dependent: green locally and in the earlier hub CI at97f21d4, red in the multi-workerauthz compatCI job after the #33 merge, on a byte-identical tree).Fix: provide
customAlphabet(a generator-returning function) in the mock so the spec is hermetic. Test-only; no production code change.Verified:
jest src/authz src/editor-compatgreen locally (342 tests). This unblocks the super-repo PR cccvu/wiki-v2#370, which points itsdocmostgitlink here.🤖 Generated with Claude Code