feat: caching customer to speed up check and get customer
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { expect } from "chai";
|
||||
import { AutumnInt } from "@/external/autumn/autumnCli.js";
|
||||
import { initCustomer } from "@/utils/scriptUtils/initCustomer.js";
|
||||
import { AppEnv, Organization, ProductV2 } from "@autumn/shared";
|
||||
import { AppEnv, LimitedItem, Organization, ProductV2 } from "@autumn/shared";
|
||||
import chalk from "chalk";
|
||||
import Stripe from "stripe";
|
||||
import { DrizzleCli } from "@/db/initDrizzle.js";
|
||||
@@ -21,12 +21,12 @@ import { runMigrationTest } from "./runMigrationTest.js";
|
||||
let messagesItem = constructFeatureItem({
|
||||
featureId: TestFeature.Messages,
|
||||
includedUsage: 500,
|
||||
});
|
||||
}) as LimitedItem;
|
||||
|
||||
let wordsItem = constructFeatureItem({
|
||||
featureId: TestFeature.Words,
|
||||
includedUsage: 100,
|
||||
});
|
||||
}) as LimitedItem;
|
||||
|
||||
export let free = constructProduct({
|
||||
items: [messagesItem, wordsItem],
|
||||
@@ -143,6 +143,7 @@ describe(`${chalk.yellowBright(`${testCase}: Testing migration for free product`
|
||||
stripeCli,
|
||||
testClockId,
|
||||
advanceTo: addWeeks(Date.now(), 1).getTime(),
|
||||
waitForSeconds: 30,
|
||||
});
|
||||
|
||||
let customer = await autumn.customers.get(customerId);
|
||||
|
||||
@@ -77,7 +77,7 @@ export const runMigrationTest = async ({
|
||||
to_version: toProduct.version,
|
||||
});
|
||||
|
||||
await timeout(5000);
|
||||
await timeout(10000);
|
||||
|
||||
const { subs: subsAfter } = await getSubsFromCusId({
|
||||
stripeCli,
|
||||
@@ -91,6 +91,7 @@ export const runMigrationTest = async ({
|
||||
expectSubsSame({ subsBefore, subsAfter });
|
||||
|
||||
const cusAfter = await autumn.customers.get(customerId);
|
||||
|
||||
expectFeaturesCorrect({
|
||||
customer: cusAfter,
|
||||
product: toProduct,
|
||||
|
||||
Reference in New Issue
Block a user