Skip to content

test(integration): revenue-tracking — fuller stripe-client webhook mock #3318

@bokelley

Description

@bokelley

Context

Spawned from #3289 / #3313. server/tests/integration/revenue-tracking.test.ts is describe.skip — every test fails with 400 Stripe not configured because the existing mock sets stripe: null while the webhook route requires a non-null Stripe instance to verify signatures.

Fix path

Two reasonable options:

  1. Build a fuller stripe-client mock that exposes:

    • stripe.webhooks.constructEvent(body, sig, secret) — should pass through a parsed JSON body during tests
    • stripe.invoices.retrieve(...) and friends as the webhook handlers need
    • STRIPE_WEBHOOK_SECRET set to a non-null fixture

    Pattern reference: server/tests/integration/admin-sync-revenue-backfill.test.ts (after test(integration): un-skip 11 of 13 stale integration files (#3289) #3313) shows how to share fixture state across vi.mock factories using vi.hoisted.

  2. Move revenue-tracking integration tests down to the database layer — drop the HTTP webhook framing and exercise the DB helpers directly with handcrafted invoice payloads. Loses the route-handler signature path but is easier to keep alive across SDK changes.

Acceptance

  • describe.skip('Revenue Tracking Integration Tests', ...) becomes describe(...) and all 13 tests pass against npm run test:server-integration with a local Postgres.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingclaude-triagedIssue has been triaged by the Claude Code triage routine. Remove to re-triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions