Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

add E2E_TRACK_CLICK_HEADERS, fix track sale client test

Steven Tey0dac350b19b6
diff --git a/apps/web/tests/tracks/track-lead-client.test.ts b/apps/web/tests/tracks/track-lead-client.test.ts
index 08e95c2ec9..e115bd3aad 100644
--- a/apps/web/tests/tracks/track-lead-client.test.ts
+++ b/apps/web/tests/tracks/track-lead-client.test.ts
@@ -27,6 +27,7 @@ describe("POST /track/lead/client", async () => {
const response = await fetch(`${env.E2E_BASE_URL}/api/track/lead/client`, {
method: "POST",
headers: {
+ ...E2E_TRACK_CLICK_HEADERS,
"Content-Type": "application/json",
Authorization: `Bearer ${env.E2E_PUBLISHABLE_KEY}`,
},
diff --git a/apps/web/tests/tracks/track-sale-client-test.ts b/apps/web/tests/tracks/track-sale-client.test.ts
similarity index 85%
rename from apps/web/tests/tracks/track-sale-client-test.ts
rename to apps/web/tests/tracks/track-sale-client.test.ts
index 6d858feb63..6a9235894c 100644
--- a/apps/web/tests/tracks/track-sale-client-test.ts
+++ b/apps/web/tests/tracks/track-sale-client.test.ts
@@ -2,6 +2,7 @@ import { randomId, randomSaleAmount } from "tests/utils/helpers";
import {
E2E_CUSTOMER_EXTERNAL_ID,
E2E_CUSTOMER_ID,
+ E2E_TRACK_CLICK_HEADERS,
} from "tests/utils/resource";
import { describe, expect, test } from "vitest";
import { IntegrationHarness } from "../utils/integration";
@@ -22,16 +23,20 @@ describe("POST /track/sale/client", async () => {
const response = await fetch(`${env.E2E_BASE_URL}/api/track/sale/client`, {
method: "POST",
headers: {
+ ...E2E_TRACK_CLICK_HEADERS,
"Content-Type": "application/json",
Authorization: `Bearer ${env.E2E_PUBLISHABLE_KEY}`,
},
- body: JSON.stringify({}),
+ body: JSON.stringify({
+ ...sale,
+ customerExternalId: E2E_CUSTOMER_EXTERNAL_ID,
+ }),
});
- const leadResponse = await response.json();
+ const saleResponse = await response.json();
expect(response.status).toEqual(200);
- expect(leadResponse).toStrictEqual({
+ expect(saleResponse).toStrictEqual({
eventName: "Subscription",
customer: {
id: E2E_CUSTOMER_ID,