Skip to content

test(collab): complete nanoid mock in #344 gateway spec (fix CI) - #34

Merged
PMQ9 merged 1 commit into
wiki-v2from
fix/343-nanoid-mock-customalphabet
Sep 17, 2026
Merged

PMQ9 merged 1 commit into
wiki-v2from
fix/343-nanoid-mock-customalphabet

Conversation

@PMQ9

@PMQ9 PMQ9 commented Sep 17, 2026

Copy link
Copy Markdown

Follow-up to #33. The #344 gateway spec (collaboration-gateway-redis.spec.ts) 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 incomplete mock that export is undefined, so the suite threw TypeError: customAlphabet is not a function at load — non-deterministically (jest module load-order dependent: green locally and in the earlier hub CI at 97f21d4, red in the multi-worker authz compat CI 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-compat green locally (342 tests). This unblocks the super-repo PR cccvu/wiki-v2#370, which points its docmost gitlink here.

🤖 Generated with Claude Code

…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]>
@PMQ9
PMQ9 merged commit c863039 into wiki-v2 Sep 17, 2026
@PMQ9
PMQ9 deleted the fix/343-nanoid-mock-customalphabet branch September 17, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant