From ff83e561dbc33261f825ee919ddf8c820c2e249d Mon Sep 17 00:00:00 2001 From: John Yeo Date: Fri, 25 Jul 2025 15:48:25 +0100 Subject: [PATCH] fix: trigger checkout reward from checkout.completed --- server/tests/attach/free/free1.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/server/tests/attach/free/free1.ts b/server/tests/attach/free/free1.ts index 81ae30fb4..3c6539f9c 100644 --- a/server/tests/attach/free/free1.ts +++ b/server/tests/attach/free/free1.ts @@ -21,6 +21,8 @@ import { constructProduct } from "@/utils/scriptUtils/createTestProducts.js"; import { addDays } from "date-fns"; import { expect } from "chai"; import { eq } from "drizzle-orm"; +import { CacheManager } from "@/external/caching/CacheManager.js"; +import { clearOrgCache } from "@/internal/orgs/orgUtils/clearOrgCache.js"; const testCase = "free1"; @@ -83,6 +85,12 @@ describe(`${chalk.yellowBright(`${testCase}: Testing free product with trial and }) .where(eq(organizations.id, org.id)); + await clearOrgCache({ + db, + orgId: org.id, + env, + }); + const { testClockId: testClockId1 } = await initCustomer({ autumn: autumnJs, customerId, @@ -109,7 +117,7 @@ describe(`${chalk.yellowBright(`${testCase}: Testing free product with trial and }); const approximateDiff = 1000 * 60 * 30; // 30 minutes - it("should attach pro product (prepaid single use)", async function () { + it("should attach free product with trial", async function () { let attachPreview = await autumn.attachPreview({ customer_id: customerId, product_id: free.id, @@ -191,5 +199,13 @@ describe(`${chalk.yellowBright(`${testCase}: Testing free product with trial and }, }) .where(eq(organizations.id, org.id)); + + await clearOrgCache({ + db, + orgId: org.id, + env, + }); + + await CacheManager.disconnect(); }); });