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.

small fixes

Kiran K42cde296f524
diff --git a/apps/web/tests/domains/index.test.ts b/apps/web/tests/domains/index.test.ts
index 67ce23d2af..33749d74e3 100644
--- a/apps/web/tests/domains/index.test.ts
+++ b/apps/web/tests/domains/index.test.ts
@@ -31,10 +31,6 @@ describe.sequential("/domains/**", async () => {
const h = new IntegrationHarness();
const { workspace, http } = await h.init();
- onTestFinished(async () => {
- await h.deleteDomain(domainRecord.slug);
- });
-
test("POST /domains", async () => {
const { status, data: domain } = await http.post<Domain>({
path: "/domains",
@@ -89,6 +85,10 @@ describe.sequential("/domains/**", async () => {
archived: true,
};
+ onTestFinished(async () => {
+ await h.deleteDomain(domainRecord.slug);
+ });
+
const { status, data: domain } = await http.patch<Domain>({
path: `/domains/${domainRecord.slug}`,
query: { workspaceId: workspace.id },
diff --git a/apps/web/tests/links/bulk-update-link.test.ts b/apps/web/tests/links/bulk-update-link.test.ts
index bf0e02651c..080fd3f4bc 100644
--- a/apps/web/tests/links/bulk-update-link.test.ts
+++ b/apps/web/tests/links/bulk-update-link.test.ts
@@ -67,7 +67,7 @@ test("PATCH /links/bulk", async (ctx) => {
});
expect(status).toEqual(200);
- expect(links).toHaveLength(2);
+ expect(links).toHaveLength(3);
// first link should be updated
expect(links[0]).toStrictEqual({
diff --git a/apps/web/tests/links/retrieve-link.test.ts b/apps/web/tests/links/retrieve-link.test.ts
index 5b36ac535b..dc54f4528f 100644
--- a/apps/web/tests/links/retrieve-link.test.ts
+++ b/apps/web/tests/links/retrieve-link.test.ts
@@ -1,13 +1,13 @@
import { Link } from "@dub/prisma/client";
import { expectedLink } from "tests/utils/schema";
-import { describe, expect, onTestFinished, test } from "vitest";
+import { afterAll, describe, expect, onTestFinished, test } from "vitest";
import { randomId } from "../utils/helpers";
import { IntegrationHarness } from "../utils/integration";
import { E2E_LINK } from "../utils/resource";
const { domain, url } = E2E_LINK;
-describe.sequential("GET /links/{linkId}", async () => {
+describe.concurrent("GET /links/{linkId}", async () => {
const h = new IntegrationHarness();
const { workspace, http, user } = await h.init();
const workspaceId = workspace.id;
@@ -15,10 +15,6 @@ describe.sequential("GET /links/{linkId}", async () => {
const externalId = randomId();
const key = randomId();
- onTestFinished(async () => {
- await h.deleteLink(newLink.id);
- });
-
const { data: newLink } = await http.post<Link>({
path: "/links",
body: {
@@ -29,6 +25,10 @@ describe.sequential("GET /links/{linkId}", async () => {
},
});
+ afterAll(async () => {
+ await h.deleteLink(newLink.id);
+ });
+
test("by linkId", async () => {
const { status, data: link } = await http.get<Link>({
path: `/links/${newLink.id}`,
diff --git a/apps/web/tests/links/update-link.test.ts b/apps/web/tests/links/update-link.test.ts
index 1022cd1945..1f8689dd2b 100644
--- a/apps/web/tests/links/update-link.test.ts
+++ b/apps/web/tests/links/update-link.test.ts
@@ -1,5 +1,5 @@
import { Link } from "@dub/prisma/client";
-import { describe, expect, onTestFinished, test } from "vitest";
+import { afterAll, describe, expect, test } from "vitest";
import { randomId } from "../utils/helpers";
import { IntegrationHarness } from "../utils/integration";
import { E2E_LINK } from "../utils/resource";
@@ -14,10 +14,6 @@ describe.sequential("PATCH /links/{linkId}", async () => {
const projectId = workspaceId.replace("ws_", "");
const externalId = randomId();
- onTestFinished(async () => {
- await h.deleteLink(link.id);
- });
-
const { data: link } = await http.post<Link>({
path: "/links",
body: {
@@ -44,6 +40,10 @@ describe.sequential("PATCH /links/{linkId}", async () => {
},
};
+ afterAll(async () => {
+ await h.deleteLink(link.id);
+ });
+
test("update link using linkId", async () => {
const { data: updatedLink } = await http.patch<Link>({
path: `/links/${link.id}`,
@@ -189,10 +189,6 @@ describe.sequential(
const projectId = workspaceId.replace("ws_", "");
const externalId = randomId();
- onTestFinished(async () => {
- await h.deleteLink(link.id);
- });
-
const { data: link } = await http.post<Link>({
path: "/links",
body: {
@@ -219,6 +215,10 @@ describe.sequential(
},
};
+ afterAll(async () => {
+ await h.deleteLink(link.id);
+ });
+
test("update link using PUT", async () => {
const { data: updatedLink } = await http.put<Link>({
path: `/links/${link.id}`,
@@ -257,4 +257,4 @@ describe.sequential(
});
});
},
-);
+);
\ No newline at end of file
diff --git a/apps/web/tests/links/upsert-link.test.ts b/apps/web/tests/links/upsert-link.test.ts
index b6357358b6..84ef0f2c69 100644
--- a/apps/web/tests/links/upsert-link.test.ts
+++ b/apps/web/tests/links/upsert-link.test.ts
@@ -1,5 +1,5 @@
import { Link } from "@dub/prisma/client";
-import { describe, expect, onTestFinished, test } from "vitest";
+import { afterAll, describe, expect, test } from "vitest";
import { randomId } from "../utils/helpers";
import { IntegrationHarness } from "../utils/integration";
import { E2E_LINK } from "../utils/resource";
@@ -15,7 +15,7 @@ describe.sequential("PUT /links/upsert", async () => {
const projectId = workspaceId.replace("ws_", "");
let createdLink: Link;
- onTestFinished(async () => {
+ afterAll(async () => {
await h.deleteLink(createdLink.id);
});
@@ -57,4 +57,4 @@ describe.sequential("PUT /links/upsert", async () => {
qrCode: `https://api.dub.co/qr?url=https://${domain}/${createdLink.key}?qr=1`,
});
});
-});
+});
\ No newline at end of file