The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
update the test cases for `/links/info`
Kiran Ke3eb94791924
diff --git a/apps/web/tests/links/retrieve-link.test.ts b/apps/web/tests/links/retrieve-link.test.tsindex 1a550e4ad0..02ea970273 100644--- a/apps/web/tests/links/retrieve-link.test.ts+++ b/apps/web/tests/links/retrieve-link.test.ts@@ -7,7 +7,63 @@ import { link } from "../utils/resource";const { domain, url } = link;-describe.sequential("GET /links/**", async () => {+describe.sequential("GET /links/{linkId}", async () => {+ const h = new IntegrationHarness();+ const { workspace, http, user } = await h.init();+ const { workspaceId } = workspace;+ const projectId = workspaceId.replace("ws_", "");+ const externalId = randomId();+ const key = randomId();++ const { data: newLink } = await http.post<Link>({+ path: "/links",+ query: { workspaceId },+ body: {+ url,+ domain,+ key,+ externalId,+ },+ });++ afterAll(async () => {+ await h.deleteLink(newLink.id);+ });++ test("by linkId", async () => {+ const { status, data: link } = await http.get<Link>({+ path: `/links/${newLink.id}`,+ query: { workspaceId },+ });++ expect(status).toEqual(200);+ expect(link).toStrictEqual({+ ...expectedLink,+ ...link,+ projectId,+ userId: user.id,+ tags: [],+ });+ });++ test("by externalId", async () => {+ const { status, data: link } = await http.get<Link>({+ path: `/links/ext_${externalId}`,+ query: { workspaceId },+ });++ expect(status).toEqual(200);+ expect(link).toStrictEqual({+ ...expectedLink,+ ...link,+ projectId,+ userId: user.id,+ tags: [],+ });+ });+});++describe.sequential("GET /links/info", async () => {const h = new IntegrationHarness();const { workspace, http, user } = await h.init();const { workspaceId } = workspace;@@ -51,8 +107,8 @@ describe.sequential("GET /links/**", async () => {test("by linkId", async () => {const { status, data: link } = await http.get<Link>({- path: `/links/${newLink.id}`,- query: { workspaceId },+ path: "/links/info",+ query: { workspaceId, linkId: newLink.id },});expect(status).toEqual(200);@@ -67,8 +123,8 @@ describe.sequential("GET /links/**", async () => {test("by externalId", async () => {const { status, data: link } = await http.get<Link>({- path: `/links/ext_${externalId}`,- query: { workspaceId },+ path: "/links/info",+ query: { workspaceId, externalId: `ext_${externalId}` },});expect(status).toEqual(200);