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 dub_id + via test

Steven Tey04ac14d7c97b
diff --git a/apps/web/tests/redirects/index.test.ts b/apps/web/tests/redirects/index.test.ts
index bc1dea07f7..07d72ca18b 100644
--- a/apps/web/tests/redirects/index.test.ts
+++ b/apps/web/tests/redirects/index.test.ts
@@ -69,6 +69,20 @@ describe.runIf(env.CI)("Link Redirects", async () => {
expect(response.status).toBe(302);
});
+ test("with dub_id and via", async () => {
+ const response = await fetch(`${h.baseUrl}/track-test`, {
+ ...fetchOptions,
+ headers: {},
+ });
+
+ // the location should contain `?dub_id=` query param
+ expect(response.headers.get("location")).toMatch(/dub_id=[a-zA-Z0-9]+/);
+ // the location should contain `?via=track-test` query param
+ expect(response.headers.get("location")).toMatch(/via=track-test/);
+ expect(response.headers.get("x-powered-by")).toBe(poweredBy);
+ expect(response.status).toBe(302);
+ });
+
test("with passthrough query", async () => {
const response = await fetch(
`${h.baseUrl}/checkly-check-passthrough?utm_source=checkly`,
@@ -167,7 +181,4 @@ describe.runIf(env.CI)("Link Redirects", async () => {
expect(response.headers.get("x-powered-by")).toBe(poweredBy);
expect(response.status).toBe(302);
});
-
- // DUMMY test to record a hit on track-test
- await fetch(`${h.baseUrl}/track-test`);
});