Files
twenty/packages/twenty-server/test/integration/billing/utils/create-mock-stripe-product-updated-data.util.ts
Ana Sofia Marin Alexandre c39af5f063 Add Integration and unit tests on Billing (#9317)
Solves [ https://github.com/twentyhq/private-issues/issues/214 ]

**TLDR**
Add unit and integration tests to Billing. First approach to run jest
integration tests directly from VSCode.

**In order to run the unit tests:**
Run unit test using the CLI or with the jest extension directly from
VSCode.

**In order to run the integration tests:**
Ensure that your database has the billingTables. If that's not the case,
migrate the database with IS_BILLING_ENABLED set to true:
` npx nx run twenty-server:test:integration
test/integration/billing/suites/billing-controller.integration-spec.ts`

**Doing:**
- Unit test on transformSubscriptionEventToSubscriptionItem
- More tests cases in billingController integration tests.

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
Co-authored-by: Weiko <corentin@twenty.com>
Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com>
2025-01-09 18:30:41 +01:00

33 lines
707 B
TypeScript

import Stripe from 'stripe';
export const createMockStripeProductUpdatedData = (
overrides = {},
): Stripe.ProductUpdatedEvent.Data => ({
object: {
id: 'prod_RLN',
object: 'product',
active: true,
created: 1733410584,
default_price: null,
description: null,
images: [],
livemode: false,
marketing_features: [],
metadata: {},
name: 'kjnnjkjknkjnjkn',
package_dimensions: null,
shippable: null,
statement_descriptor: null,
tax_code: 'txcd_10103001',
type: 'service',
unit_label: null,
updated: 1734694649,
url: null,
},
previous_attributes: {
default_price: 'price_1Q',
updated: 1733410585,
},
...overrides,
});