Skip to content

fix(test): add importOriginal to stripe-client vi.mock — restores integration tests#3553

Merged
EmmaLouise2018 merged 3 commits into
mainfrom
EmmaLouise2018/fix-stripe-mock-listcustomers
Apr 30, 2026
Merged

fix(test): add importOriginal to stripe-client vi.mock — restores integration tests#3553
EmmaLouise2018 merged 3 commits into
mainfrom
EmmaLouise2018/fix-stripe-mock-listcustomers

Conversation

@EmmaLouise2018

Copy link
Copy Markdown
Contributor

Closes #3548.

Two integration tests vi.mock src/billing/stripe-client.js but the mock factories don't export listCustomersWithOrgIds. Server startup calls OrganizationDatabase.syncStripeCustomers which uses that method, throws at HTTPServer.start, breaks every integration test booting through these mocks.

Stack at fail time:

[vitest] No "listCustomersWithOrgIds" export is defined on
"../../src/billing/stripe-client.js" mock
  at OrganizationDatabase.syncStripeCustomers (server/src/db/organization-db.ts:1708:29)
  at HTTPServer.start (server/src/http.ts:8591:21)
  at server/tests/integration/content-my-content.test.ts:137:5
  at server/tests/integration/admin-endpoints.test.ts:62:5

Fix

Switch the two vi.mock factories to vitest's importOriginal pattern. Partial mocks now inherit real stripe-client exports — listCustomersWithOrgIds and 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:69
  • server/tests/integration/admin-endpoints.test.ts:28

Test 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 on ECONNREFUSED 127.0.0.1:53198 because 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 repo typecheck precommit hook).
  • Repo precommit (test:unit, test:test-dynamic-imports, typecheck) — all green.

Unblocks

…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.
@EmmaLouise2018 EmmaLouise2018 merged commit 1982d9d into main Apr 30, 2026
13 checks passed
@EmmaLouise2018 EmmaLouise2018 deleted the EmmaLouise2018/fix-stripe-mock-listcustomers branch April 30, 2026 02: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.

fix(test): add listCustomersWithOrgIds to stripe-client mock — server integration tests fail at HTTPServer.start

1 participant