The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update index.test.ts
Kiran K25bbfa84365a
diff --git a/apps/web/tests/redirects/index.test.ts b/apps/web/tests/redirects/index.test.tsindex bc0d827745..0ffc4866be 100644--- a/apps/web/tests/redirects/index.test.ts+++ b/apps/web/tests/redirects/index.test.ts@@ -116,12 +116,20 @@ describe.runIf(env.CI)("Link Redirects", async () => {test("google play store url", async () => {const response = await fetch(`${h.baseUrl}/gps`, fetchOptions);- // location to include referrer query param with the short link (https://dub.sh/gps)- expect(response.headers.get("location")).toMatch(- /referrer=deepLink%253Dhttps%253A%252F%252Fdub\.sh%252Fgps/,- );- expect(response.headers.get("x-powered-by")).toBe(poweredBy);+ const location = response.headers.get("location");+expect(response.status).toBe(302);+ expect(response.headers.get("x-powered-by")).toBe(poweredBy);+ expect(location).toBeTruthy();++ const url = new URL(location!);+ const referrerEncoded = url.searchParams.get("referrer");+ expect(referrerEncoded).toBeTruthy();++ const referrer = decodeURIComponent(referrerEncoded!);+ const params = new URLSearchParams(referrer);++ expect(params.get("deepLink")).toBe("https://dub.sh/gps");});test("google play store url with existing referrer", async () => {@@ -129,12 +137,21 @@ describe.runIf(env.CI)("Link Redirects", async () => {`${h.baseUrl}/gps-with-referrer`,fetchOptions,);- // location should include both existing referrer (utm_source=google) and new deepLink parameter- expect(response.headers.get("location")).toMatch(- /referrer=utm_source%253Dgoogle%2526deepLink%253Dhttps%253A%252F%252Fdub\.sh%252Fgps-with-referrer/,- );- expect(response.headers.get("x-powered-by")).toBe(poweredBy);+ const location = response.headers.get("location");+expect(response.status).toBe(302);+ expect(response.headers.get("x-powered-by")).toBe(poweredBy);+ expect(location).toBeTruthy();++ const url = new URL(location!);+ const referrerEncoded = url.searchParams.get("referrer");+ expect(referrerEncoded).toBeTruthy();++ const referrer = decodeURIComponent(referrerEncoded!);+ const params = new URLSearchParams(referrer);++ expect(params.get("utm_source")).toBe("google");+ expect(params.get("deepLink")).toBe("https://dub.sh/gps-with-referrer");});test("query params with no value", async () => {