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.

fix tests

Steven Tey8f3da2cd60dc
diff --git a/apps/web/tests/links/bulk-create-link.test.ts b/apps/web/tests/links/bulk-create-link.test.ts
index afd93c3555..bed658c68b 100644
--- a/apps/web/tests/links/bulk-create-link.test.ts
+++ b/apps/web/tests/links/bulk-create-link.test.ts
@@ -38,7 +38,6 @@ test("POST /links/bulk", async (ctx) => {
workspaceId,
shortLink: `https://${domain}/${firstLink?.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${firstLink?.key}?qr=1`,
- tags: [],
});
expect(secondLink).toStrictEqual({
...expectedLink,
@@ -48,7 +47,6 @@ test("POST /links/bulk", async (ctx) => {
workspaceId,
shortLink: `https://${domain}/${secondLink?.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${secondLink?.key}?qr=1`,
- tags: [],
});
expect(z.array(LinkSchema.strict()).parse(links)).toBeTruthy();
diff --git a/apps/web/tests/links/create-link.test.ts b/apps/web/tests/links/create-link.test.ts
index c28e55760e..387e300335 100644
--- a/apps/web/tests/links/create-link.test.ts
+++ b/apps/web/tests/links/create-link.test.ts
@@ -39,7 +39,6 @@ describe.sequential("POST /links", async () => {
workspaceId: null,
shortLink: `https://${domain}/${link.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`,
- tags: [],
});
});
@@ -71,7 +70,6 @@ describe.sequential("POST /links", async () => {
workspaceId,
shortLink: `https://${domain}/${link.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`,
- tags: [],
});
expect(LinkSchema.strict().parse(link)).toBeTruthy();
@@ -102,7 +100,6 @@ describe.sequential("POST /links", async () => {
workspaceId,
shortLink: `https://${domain}/${key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${key}?qr=1`,
- tags: [],
});
expect(LinkSchema.strict().parse(link)).toBeTruthy();
@@ -136,7 +133,6 @@ describe.sequential("POST /links", async () => {
workspaceId,
shortLink: `https://${domain}/${link.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`,
- tags: [],
});
expect(LinkSchema.strict().parse(link)).toBeTruthy();
@@ -177,7 +173,6 @@ describe.sequential("POST /links", async () => {
workspaceId,
shortLink: `https://${domain}/${link.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`,
- tags: [],
});
expect(LinkSchema.strict().parse(link)).toBeTruthy();
@@ -208,7 +203,6 @@ describe.sequential("POST /links", async () => {
workspaceId,
shortLink: `https://${domain}/${link.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`,
- tags: [],
});
expect(LinkSchema.strict().parse(link)).toBeTruthy();
@@ -242,7 +236,6 @@ describe.sequential("POST /links", async () => {
workspaceId,
shortLink: `https://${domain}/${link.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`,
- tags: [],
});
expect(LinkSchema.strict().parse(link)).toBeTruthy();
@@ -277,7 +270,6 @@ describe.sequential("POST /links", async () => {
workspaceId,
shortLink: `https://${domain}/${link.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`,
- tags: [],
});
expect(LinkSchema.strict().parse(link)).toBeTruthy();
@@ -312,7 +304,6 @@ describe.sequential("POST /links", async () => {
workspaceId,
shortLink: `https://${domain}/${link.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`,
- tags: [],
});
expect(LinkSchema.strict().parse(link)).toBeTruthy();
@@ -402,7 +393,6 @@ describe.sequential("POST /links", async () => {
workspaceId,
shortLink: `https://${domain}/${link.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`,
- tags: [],
});
expect(LinkSchema.strict().parse(link)).toBeTruthy();
@@ -436,7 +426,6 @@ describe.sequential("POST /links?workspaceId=xxx", async () => {
workspaceId,
shortLink: `https://${domain}/${link.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`,
- tags: [],
});
expect(LinkSchema.strict().parse(link)).toBeTruthy();
diff --git a/apps/web/tests/links/list-links.test.ts b/apps/web/tests/links/list-links.test.ts
index d3cacf548f..86dfaef0ea 100644
--- a/apps/web/tests/links/list-links.test.ts
+++ b/apps/web/tests/links/list-links.test.ts
@@ -31,7 +31,7 @@ test("GET /links", async (ctx) => {
userId: user.id,
projectId,
workspaceId,
- tags: [],
+
shortLink: `https://${domain}/${firstLink.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${firstLink.key}?qr=1`,
});
diff --git a/apps/web/tests/links/retrieve-link.test.ts b/apps/web/tests/links/retrieve-link.test.ts
index a1aa4d4128..fef4dbf0d4 100644
--- a/apps/web/tests/links/retrieve-link.test.ts
+++ b/apps/web/tests/links/retrieve-link.test.ts
@@ -40,7 +40,6 @@ describe.sequential("GET /links/{linkId}", async () => {
...link,
projectId,
userId: user.id,
- tags: [],
});
});
@@ -55,7 +54,6 @@ describe.sequential("GET /links/{linkId}", async () => {
...link,
projectId,
userId: user.id,
- tags: [],
});
});
});
@@ -97,7 +95,6 @@ describe.sequential("GET /links/info", async () => {
userId: user.id,
shortLink: `https://${domain}/${key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${key}?qr=1`,
- tags: [],
});
});
@@ -113,7 +110,6 @@ describe.sequential("GET /links/info", async () => {
...link,
projectId,
userId: user.id,
- tags: [],
});
});
@@ -129,7 +125,6 @@ describe.sequential("GET /links/info", async () => {
...link,
projectId,
userId: user.id,
- tags: [],
});
});
});
diff --git a/apps/web/tests/links/update-link.test.ts b/apps/web/tests/links/update-link.test.ts
index b85c967cd1..ec6e87d9bf 100644
--- a/apps/web/tests/links/update-link.test.ts
+++ b/apps/web/tests/links/update-link.test.ts
@@ -62,7 +62,6 @@ describe.sequential("PATCH /links/{linkId}", async () => {
projectId,
shortLink: `https://${domain}/${toUpdate.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${toUpdate.key}?qr=1`,
- tags: [],
});
// Fetch the link
@@ -81,7 +80,6 @@ describe.sequential("PATCH /links/{linkId}", async () => {
projectId,
shortLink: `https://${domain}/${toUpdate.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${toUpdate.key}?qr=1`,
- tags: [],
});
});
@@ -107,7 +105,6 @@ describe.sequential("PATCH /links/{linkId}", async () => {
projectId,
shortLink: `https://${domain}/${toUpdate.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${toUpdate.key}?qr=1`,
- tags: [],
});
// Fetch the link
@@ -140,7 +137,6 @@ describe.sequential("PATCH /links/{linkId}", async () => {
projectId,
shortLink: `https://${domain}/${toUpdate.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${toUpdate.key}?qr=1`,
- tags: [],
});
// Fetch the link
@@ -174,7 +170,6 @@ describe.sequential("PATCH /links/{linkId}", async () => {
projectId,
shortLink: `https://${domain}/${toUpdate.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${toUpdate.key}?qr=1`,
- tags: [],
});
// Fetch the link
@@ -243,7 +238,6 @@ describe.sequential(
projectId,
shortLink: `https://${domain}/${toUpdate.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${toUpdate.key}?qr=1`,
- tags: [],
});
// Fetch the link
@@ -262,7 +256,6 @@ describe.sequential(
projectId,
shortLink: `https://${domain}/${toUpdate.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${toUpdate.key}?qr=1`,
- tags: [],
});
});
},
diff --git a/apps/web/tests/links/upsert-link.test.ts b/apps/web/tests/links/upsert-link.test.ts
index 48c233b71f..07a9cc22a6 100644
--- a/apps/web/tests/links/upsert-link.test.ts
+++ b/apps/web/tests/links/upsert-link.test.ts
@@ -36,7 +36,6 @@ describe.sequential("PUT /links/upsert", async () => {
workspaceId,
shortLink: `https://${domain}/${createdLink.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${createdLink.key}?qr=1`,
- tags: [],
});
});
@@ -56,7 +55,6 @@ describe.sequential("PUT /links/upsert", async () => {
comments: "Updated comment",
shortLink: `https://${domain}/${createdLink.key}`,
qrCode: `https://api.dub.co/qr?url=https://${domain}/${createdLink.key}?qr=1`,
- tags: [],
});
});
});
diff --git a/apps/web/tests/utils/schema.ts b/apps/web/tests/utils/schema.ts
index c56d751dd8..e0813159f4 100644
--- a/apps/web/tests/utils/schema.ts
+++ b/apps/web/tests/utils/schema.ts
@@ -1,7 +1,11 @@
import { Link, Project, Tag } from "@prisma/client";
import { expect } from "vitest";
-export const expectedLink: Partial<Link> & { tagId: string | null } = {
+export const expectedLink: Partial<Link> & {
+ tagId: string | null;
+ tags: [];
+ webhooks: [];
+} = {
id: expect.any(String),
key: expect.any(String),
domain: "dub.sh",
@@ -32,6 +36,8 @@ export const expectedLink: Partial<Link> & { tagId: string | null } = {
saleAmount: 0,
tagId: null, // backwards compatibility
comments: null,
+ tags: [],
+ webhooks: [],
createdAt: expect.any(String),
updatedAt: expect.any(String),
expiredUrl: null,
diff --git a/packages/utils/src/constants/misc.ts b/packages/utils/src/constants/misc.ts
index abac1e8181..cc981af2f0 100644
--- a/packages/utils/src/constants/misc.ts
+++ b/packages/utils/src/constants/misc.ts
@@ -3,7 +3,6 @@ export const DEFAULT_LINK_PROPS: any = {
url: "",
domain: "",
archived: false,
- tags: [],
title: null,
description: null,