fix(test): add importOriginal to stripe-client vi.mock — restores integration tests#3553
Merged
EmmaLouise2018 merged 3 commits intoApr 30, 2026
Merged
Conversation
…egration tests Closes #3548. Two integration tests vi.mock src/billing/stripe-client.js but the mock factories did not export listCustomersWithOrgIds. Server startup calls OrganizationDatabase.syncStripeCustomers which uses that method, threw at HTTPServer.start, broke every integration test that booted through these mocks. Fix: switch the mock factories to vitest's importOriginal pattern so partial mocks inherit real exports. listCustomersWithOrgIds (and any future stripe-client method) flow through automatically. Files: - server/tests/integration/content-my-content.test.ts - server/tests/integration/admin-endpoints.test.ts This unblocks the integration-tests CI job on #3540 and any future PR that adds tests booting the server through these mocks.
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.
Closes #3548.
Two integration tests
vi.mocksrc/billing/stripe-client.jsbut the mock factories don't exportlistCustomersWithOrgIds. Server startup callsOrganizationDatabase.syncStripeCustomerswhich uses that method, throws atHTTPServer.start, breaks every integration test booting through these mocks.Stack at fail time:
Fix
Switch the two
vi.mockfactories to vitest'simportOriginalpattern. Partial mocks now inherit realstripe-clientexports —listCustomersWithOrgIdsand every future method flow through automatically without per-PR mock churn. Strictly better than the previous explicit-export pattern.Files
server/tests/integration/content-my-content.test.ts:69server/tests/integration/admin-endpoints.test.ts:28Test plan
npx vitest run server/tests/integration/content-my-content.test.ts server/tests/integration/admin-endpoints.test.ts --config server/vitest.config.ts— mock failure resolved locally; tests then short-circuit onECONNREFUSED 127.0.0.1:53198because local Postgres is unavailable in this worktree. CI has Postgres and will run the full suite.tsc --noEmit -p server/tsconfig.json— clean (also verified by repotypecheckprecommit hook).test:unit,test:test-dynamic-imports,typecheck) — all green.Unblocks