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.

make tests more resilient

Steven Teyc5a9308eebc8
diff --git a/apps/web/lib/middleware/utils/parse.ts b/apps/web/lib/middleware/utils/parse.ts
index 1097b1043c..2cafc5b744 100644
--- a/apps/web/lib/middleware/utils/parse.ts
+++ b/apps/web/lib/middleware/utils/parse.ts
@@ -9,7 +9,7 @@ export const parse = (req: NextRequest) => {
// remove www. from domain and convert to lowercase
domain = domain.replace(/^www./, "").toLowerCase();
if (domain === "dub.localhost:8888" || domain.endsWith(".vercel.app")) {
- if (path === "/cAsE") {
+ if (path.toLowerCase() === "/case-sensitive-test") {
// special case for case-sensitive link test
domain = "dub-internal-test.com";
} else {
diff --git a/apps/web/tests/redirects/index.test.ts b/apps/web/tests/redirects/index.test.ts
index c1410944ed..bc1dea07f7 100644
--- a/apps/web/tests/redirects/index.test.ts
+++ b/apps/web/tests/redirects/index.test.ts
@@ -109,7 +109,10 @@ describe.runIf(env.CI)("Link Redirects", async () => {
});
test("with case-sensitive (correct) key", async () => {
- const response = await fetch(`${h.baseUrl}/cAsE`, fetchOptions);
+ const response = await fetch(
+ `${h.baseUrl}/cAsE-sensitive-test`,
+ fetchOptions,
+ );
expect(response.headers.get("location")).toBe(
"https://dub.co/changelog/case-insensitive-links",
@@ -119,7 +122,10 @@ describe.runIf(env.CI)("Link Redirects", async () => {
});
test("with case-sensitive (incorrect) key", async () => {
- const response = await fetch(`${h.baseUrl}/case`, fetchOptions);
+ const response = await fetch(
+ `${h.baseUrl}/case-sensitive-test`,
+ fetchOptions,
+ );
expect(response.headers.get("location")).toBe("https://dub.co/");
expect(response.headers.get("x-powered-by")).toBe(poweredBy);