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 tests

Steven Teydc453e084564
diff --git a/apps/web/tests/redirects/index.test.ts b/apps/web/tests/redirects/index.test.ts
index 8237805784..9d4a90511b 100644
--- a/apps/web/tests/redirects/index.test.ts
+++ b/apps/web/tests/redirects/index.test.ts
@@ -43,6 +43,32 @@ describe.runIf(env.CI)("Link Redirects", async () => {
expect(response.status).toBe(302);
});
+ test("with dub_id", async () => {
+ const response = await fetch(`${h.baseUrl}/conversion-tracking`, {
+ ...fetchOptions,
+ headers: {},
+ });
+
+ // the location should contain `?dub_id=` query param
+ expect(response.headers.get("location")).toMatch(/dub_id=[a-zA-Z0-9]+/);
+ expect(response.headers.get("x-powered-by")).toBe(poweredBy);
+ expect(response.status).toBe(302);
+ });
+
+ test("with dub_client_reference_id", async () => {
+ const response = await fetch(`${h.baseUrl}/client_reference_id`, {
+ ...fetchOptions,
+ headers: {},
+ });
+
+ // the location should contain `?client_reference_id=dub_id_` query param
+ expect(response.headers.get("location")).toMatch(
+ /client_reference_id=dub_id_[a-zA-Z0-9]+/,
+ );
+ 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`,