Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changeset/fix-stripe-mock-listcustomers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

Switch the `stripe-client` `vi.mock` factories in `content-my-content.test.ts` and `admin-endpoints.test.ts` to vitest's `importOriginal` pattern so unmocked exports (e.g. `listCustomersWithOrgIds` called from `OrganizationDatabase.syncStripeCustomers` during `HTTPServer.start`) flow through automatically and stop breaking integration tests.
8 changes: 6 additions & 2 deletions server/tests/integration/admin-endpoints.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ vi.mock('../../src/middleware/csrf.js', () => ({
csrfProtection: (_req: any, _res: any, next: any) => next(),
}));

// Mock Stripe client to control subscription checks
vi.mock('../../src/billing/stripe-client.js', () => ({
// Mock Stripe client to control subscription checks. Use importOriginal so
// any unmocked exports (e.g. listCustomersWithOrgIds called from
// OrganizationDatabase.syncStripeCustomers during HTTPServer.start) flow
// through to the real implementation instead of throwing.
vi.mock('../../src/billing/stripe-client.js', async (importOriginal) => ({
...(await importOriginal<typeof import('../../src/billing/stripe-client.js')>()),
stripe: null,
getSubscriptionInfo: vi.fn().mockResolvedValue(null),
createStripeCustomer: vi.fn().mockResolvedValue(null),
Expand Down
6 changes: 5 additions & 1 deletion server/tests/integration/content-my-content.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ vi.mock('../../src/addie/mcp/admin-tools.js', async (importOriginal) => {
};
});

vi.mock('../../src/billing/stripe-client.js', () => ({
// Use importOriginal so any unmocked exports (e.g. listCustomersWithOrgIds
// called from OrganizationDatabase.syncStripeCustomers during HTTPServer.start)
// flow through to the real implementation instead of throwing.
vi.mock('../../src/billing/stripe-client.js', async (importOriginal) => ({
...(await importOriginal<typeof import('../../src/billing/stripe-client.js')>()),
stripe: null,
getSubscriptionInfo: vi.fn().mockResolvedValue(null),
createStripeCustomer: vi.fn().mockResolvedValue(null),
Expand Down
Loading