The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
update tests
Steven Teyc848a76992ea
diff --git a/apps/web/tests/tracks/track-lead.test.ts b/apps/web/tests/tracks/track-lead.test.tsindex 44f4958564..5dcd9e6740 100644--- a/apps/web/tests/tracks/track-lead.test.ts+++ b/apps/web/tests/tracks/track-lead.test.ts@@ -53,7 +53,7 @@ describe("POST /track/lead", async () => {body: {clickId: trackedClickId,eventName: "Signup",- externalId: customer1.externalId,+ customerExternalId: customer1.externalId,customerName: customer1.name,customerEmail: customer1.email,customerAvatar: customer1.avatar,@@ -73,7 +73,7 @@ describe("POST /track/lead", async () => {body: {clickId: trackedClickId,eventName: "Signup",- externalId: customer1.externalId,+ customerExternalId: customer1.externalId,customerName: customer1.name,customerEmail: customer1.email,customerAvatar: customer1.avatar,@@ -95,7 +95,7 @@ describe("POST /track/lead", async () => {body: {clickId: trackedClickId,eventName: "Start Trial",- externalId: customer2.externalId,+ customerExternalId: customer2.externalId,customerName: customer2.name,customerEmail: customer2.email,customerAvatar: customer2.avatar,@@ -117,7 +117,7 @@ describe("POST /track/lead", async () => {body: {clickId: trackedClickId,eventName: "Mode=Wait Signup",- externalId: customer3.externalId,+ customerExternalId: customer3.externalId,customerName: customer3.name,customerEmail: customer3.email,customerAvatar: customer3.avatar,@@ -133,7 +133,7 @@ describe("POST /track/lead", async () => {const saleResponse = await http.post<TrackSaleResponse>({path: "/track/sale",body: {- externalId: customer3.externalId,+ customerExternalId: customer3.externalId,eventName: "Mode=Wait Purchase",amount: 500,paymentProcessor: "stripe",@@ -143,13 +143,13 @@ describe("POST /track/lead", async () => {expect(saleResponse.status).toEqual(200);});- test("track a lead with `customerId` (backward compatibility)", async () => {+ test("track a lead with `externalId` (backward compatibility)", async () => {const customer4 = randomCustomer();const response = await http.post<TrackLeadResponse>({path: "/track/lead",body: {clickId: trackedClickId,- customerId: customer4.externalId,+ externalId: customer4.externalId,eventName: "Signup",customerName: customer4.name,customerEmail: customer4.email,@@ -163,4 +163,25 @@ describe("POST /track/lead", async () => {clickId: trackedClickId,});});++ test("track a lead with `customerId` (backward compatibility)", async () => {+ const customer5 = randomCustomer();+ const response = await http.post<TrackLeadResponse>({+ path: "/track/lead",+ body: {+ clickId: trackedClickId,+ customerId: customer5.externalId,+ eventName: "Signup",+ customerName: customer5.name,+ customerEmail: customer5.email,+ customerAvatar: customer5.avatar,+ },+ });++ expectValidLeadResponse({+ response,+ customer: customer5,+ clickId: trackedClickId,+ });+ });});diff --git a/apps/web/tests/tracks/track-sale.test.ts b/apps/web/tests/tracks/track-sale.test.tsindex e088a332a2..419d2cdea8 100644--- a/apps/web/tests/tracks/track-sale.test.ts+++ b/apps/web/tests/tracks/track-sale.test.ts@@ -20,7 +20,7 @@ const expectValidSaleResponse = (name: expect.any(String),email: expect.any(String),avatar: expect.any(String),- externalId: E2E_CUSTOMER_EXTERNAL_ID,+ customerExternalId: E2E_CUSTOMER_EXTERNAL_ID,},sale: {amount: sale.amount,@@ -58,7 +58,7 @@ describe("POST /track/sale", async () => {path: "/track/sale",body: {...sale,- externalId: E2E_CUSTOMER_EXTERNAL_ID,+ customerExternalId: E2E_CUSTOMER_EXTERNAL_ID,},});@@ -70,7 +70,7 @@ describe("POST /track/sale", async () => {path: "/track/sale",body: {...sale,- externalId: E2E_CUSTOMER_EXTERNAL_ID,+ customerExternalId: E2E_CUSTOMER_EXTERNAL_ID,invoiceId: sale.invoiceId,},});@@ -89,7 +89,7 @@ describe("POST /track/sale", async () => {body: {...sale,invoiceId: `INV_${randomId()}`,- externalId: "external-id-that-does-not-exist",+ customerExternalId: "external-id-that-does-not-exist",},});@@ -101,7 +101,7 @@ describe("POST /track/sale", async () => {});});- test("track a sale with `customerId` (backward compatibility)", async () => {+ test("track a sale with `externalId` (backward compatibility)", async () => {const newSale = {...sale,invoiceId: `INV_${randomId()}`,@@ -112,13 +112,31 @@ describe("POST /track/sale", async () => {path: "/track/sale",body: {...newSale,- customerId: E2E_CUSTOMER_EXTERNAL_ID,+ externalId: E2E_CUSTOMER_EXTERNAL_ID,},});expectValidSaleResponse(response4, newSale);});+ test("track a sale with `customerId` (backward compatibility)", async () => {+ const newSale = {+ ...sale,+ invoiceId: `INV_${randomId()}`,+ amount: randomSaleAmount(),+ };++ const response5 = await http.post<TrackSaleResponse>({+ path: "/track/sale",+ body: {+ ...newSale,+ customerId: E2E_CUSTOMER_EXTERNAL_ID,+ },+ });++ expectValidSaleResponse(response5, newSale);+ });+test("track a sale with JPY currency (zero decimal currency)", async () => {const jpySale = {...sale,@@ -132,7 +150,7 @@ describe("POST /track/sale", async () => {path: "/track/sale",body: {...jpySale,- externalId: E2E_CUSTOMER_EXTERNAL_ID,+ customerExternalId: E2E_CUSTOMER_EXTERNAL_ID,},});