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>
35 lines
789 B
TypeScript
35 lines
789 B
TypeScript
import Stripe from 'stripe';
|
|
export const createMockStripePriceCreatedData = (
|
|
overrides = {},
|
|
): Stripe.PriceCreatedEvent.Data => ({
|
|
object: {
|
|
id: 'price_1Q',
|
|
object: 'price',
|
|
active: true,
|
|
billing_scheme: 'per_unit',
|
|
created: 1733734326,
|
|
currency: 'usd',
|
|
custom_unit_amount: null,
|
|
livemode: false,
|
|
lookup_key: null,
|
|
metadata: {},
|
|
nickname: null,
|
|
product: 'prod_RLN',
|
|
recurring: {
|
|
aggregate_usage: null,
|
|
interval: 'month',
|
|
interval_count: 1,
|
|
meter: null,
|
|
trial_period_days: null,
|
|
usage_type: 'licensed',
|
|
},
|
|
tax_behavior: 'unspecified',
|
|
tiers_mode: null,
|
|
transform_quantity: null,
|
|
type: 'recurring',
|
|
unit_amount: 0,
|
|
unit_amount_decimal: '0',
|
|
...overrides,
|
|
},
|
|
});
|