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.

Update update-link.test.ts

Steven Tey04dff83f086f
diff --git a/apps/web/tests/links/update-link.test.ts b/apps/web/tests/links/update-link.test.ts
index 42b18a24a5..7d90507876 100644
--- a/apps/web/tests/links/update-link.test.ts
+++ b/apps/web/tests/links/update-link.test.ts
@@ -87,13 +87,13 @@ describe.sequential("PATCH /links/{linkId}", async () => {
});
});
- // Update the link using externalId
- test("update link using externalId", async () => {
+ // Archive the link
+ test("archive link", async () => {
const { status, data: updatedLink } = await http.patch<Link>({
- path: `/links/ext_${externalId}`,
+ path: `/links/${link.id}`,
query: { workspaceId },
body: {
- url: "https://github.com/dubinc",
+ archived: true,
},
});
@@ -104,9 +104,8 @@ describe.sequential("PATCH /links/{linkId}", async () => {
domain,
workspaceId,
externalId,
- archived: false,
+ archived: true,
userId: user.id,
- url: "https://github.com/dubinc",
expiresAt: "2030-04-16T17:00:00.000Z",
projectId: workspaceId.replace("ws_", ""),
shortLink: `https://${domain}/${toUpdate.key}`,
@@ -115,21 +114,21 @@ describe.sequential("PATCH /links/{linkId}", async () => {
});
// Fetch the link
- const { data: linkUpdated } = await http.get<Link>({
- path: `/links/ext_${externalId}`,
+ const { data: archivedLink } = await http.get<Link>({
+ path: `/links/${link.id}`,
query: { workspaceId },
});
- expect(linkUpdated.url).toEqual("https://github.com/dubinc");
+ expect(archivedLink.archived).toEqual(true);
});
- // Archive the link
- test("archive link", async () => {
+ // Unarchive the link
+ test("unarchive link", async () => {
const { status, data: updatedLink } = await http.patch<Link>({
path: `/links/${link.id}`,
query: { workspaceId },
body: {
- archived: true,
+ archived: false,
},
});
@@ -140,7 +139,7 @@ describe.sequential("PATCH /links/{linkId}", async () => {
domain,
workspaceId,
externalId,
- archived: true,
+ archived: false,
userId: user.id,
expiresAt: "2030-04-16T17:00:00.000Z",
projectId: workspaceId.replace("ws_", ""),
@@ -150,21 +149,21 @@ describe.sequential("PATCH /links/{linkId}", async () => {
});
// Fetch the link
- const { data: archivedLink } = await http.get<Link>({
+ const { data: unarchivedLink } = await http.get<Link>({
path: `/links/${link.id}`,
query: { workspaceId },
});
- expect(archivedLink.archived).toEqual(true);
+ expect(unarchivedLink.archived).toEqual(false);
});
- // Unarchive the link
- test("unarchive link", async () => {
+ // Update the link using externalId
+ test("update link using externalId", async () => {
const { status, data: updatedLink } = await http.patch<Link>({
- path: `/links/${link.id}`,
+ path: `/links/ext_${externalId}`,
query: { workspaceId },
body: {
- archived: false,
+ url: "https://github.com/dubinc",
},
});
@@ -177,6 +176,7 @@ describe.sequential("PATCH /links/{linkId}", async () => {
externalId,
archived: false,
userId: user.id,
+ url: "https://github.com/dubinc",
expiresAt: "2030-04-16T17:00:00.000Z",
projectId: workspaceId.replace("ws_", ""),
shortLink: `https://${domain}/${toUpdate.key}`,
@@ -185,12 +185,12 @@ describe.sequential("PATCH /links/{linkId}", async () => {
});
// Fetch the link
- const { data: unarchivedLink } = await http.get<Link>({
- path: `/links/${link.id}`,
+ const { data: linkUpdated } = await http.get<Link>({
+ path: `/links/ext_${externalId}`,
query: { workspaceId },
});
- expect(unarchivedLink.archived).toEqual(false);
+ expect(linkUpdated.url).toEqual("https://github.com/dubinc");
});
});