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.

Refactor fetch URLs in link redirects tests

Kiran Kc6ebede1c91f
diff --git a/apps/web/tests/redirects/index.test.ts b/apps/web/tests/redirects/index.test.ts
index 8e364d20d4..b3694ff50b 100644
--- a/apps/web/tests/redirects/index.test.ts
+++ b/apps/web/tests/redirects/index.test.ts
@@ -39,10 +39,7 @@ describe.sequential("Link Redirects", async () => {
},
});
- const response = await fetch(
- `${h.env.E2E_BASE_URL}/${link.key}`,
- fetchOptions,
- );
+ const response = await fetch(`${h.baseUrl}/${link.key}`, fetchOptions);
expect(response.headers.get("location")).toBe(url);
expect(response.headers.get("x-powered-by")).toBe(poweredBy);
@@ -64,10 +61,7 @@ describe.sequential("Link Redirects", async () => {
},
});
- const response = await fetch(
- `${h.env.E2E_BASE_URL}/${link.key}`,
- fetchOptions,
- );
+ const response = await fetch(`${h.baseUrl}/${link.key}`, fetchOptions);
expect(response.headers.get("location")).toBe(url);
expect(response.headers.get("x-powered-by")).toBe(poweredBy);
@@ -89,10 +83,7 @@ describe.sequential("Link Redirects", async () => {
},
});
- const response = await fetch(
- `${h.env.E2E_BASE_URL}/${link.key}`,
- fetchOptions,
- );
+ const response = await fetch(`${h.baseUrl}/${link.key}`, fetchOptions);
expect(response.headers.get("location")).toBe(url);
expect(response.headers.get("x-powered-by")).toBe(poweredBy);
@@ -114,10 +105,7 @@ describe.sequential("Link Redirects", async () => {
},
});
- const response = await fetch(
- `${h.env.E2E_BASE_URL}/${link.key}`,
- fetchOptions,
- );
+ const response = await fetch(`${h.baseUrl}/${link.key}`, fetchOptions);
expect(response.headers.get("location")).toBe(url);
expect(response.headers.get("x-powered-by")).toBe(poweredBy);
@@ -140,7 +128,7 @@ describe.sequential("Link Redirects", async () => {
});
const response = await fetch(
- `${h.env.E2E_BASE_URL}/${link.key}?pw=dub`,
+ `${h.baseUrl}/${link.key}?pw=dub`,
fetchOptions,
);
diff --git a/apps/web/tests/utils/integration.ts b/apps/web/tests/utils/integration.ts
index 94a1b9b513..42fc5471d8 100644
--- a/apps/web/tests/utils/integration.ts
+++ b/apps/web/tests/utils/integration.ts
@@ -12,7 +12,7 @@ interface Resources {
export class IntegrationHarness {
private readonly ctx?: TaskContext;
- public env: z.infer<typeof integrationTestEnv>;
+ private env: z.infer<typeof integrationTestEnv>;
public resources: Resources;
public baseUrl: string;
public http: HttpClient;
@@ -21,9 +21,9 @@ export class IntegrationHarness {
this.env = integrationTestEnv.parse(process.env);
this.ctx = ctx;
- this.baseUrl = this.env.E2E_BASE_URL + "/api";
+ this.baseUrl = this.env.E2E_BASE_URL;
this.http = new HttpClient({
- baseUrl: this.baseUrl,
+ baseUrl: `${this.baseUrl}/api`,
headers: {
Authorization: `Bearer ${this.env.E2E_TOKEN}`,
},