The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Fix the user object
Kiran Kb801e8f25bab
diff --git a/apps/web/tests/links/list-links.test.ts b/apps/web/tests/links/list-links.test.tsindex 18758ad2dd..1ffb46f5d9 100644--- a/apps/web/tests/links/list-links.test.ts+++ b/apps/web/tests/links/list-links.test.ts@@ -5,7 +5,7 @@ import { IntegrationHarness } from "../utils/integration";test("list links", async (ctx) => {const h = new IntegrationHarness(ctx);- const { workspace, apiKey } = await h.init();+ const { workspace, apiKey, user } = await h.init();const http = new HttpClient({baseUrl: h.baseUrl,@@ -14,21 +14,24 @@ test("list links", async (ctx) => {},});+ const domain = "dub.sh";+ const url = "https://github.com/dubinc";+// Create a linkconst { data: firstLink } = await http.post<Link>({path: "/links",query: { workspaceId: workspace.workspaceId },- body: { url: "https://google.com" },+ body: { url, domain },});// Fake delay- await new Promise((resolve) => setTimeout(resolve, 1000));+ await new Promise((resolve) => setTimeout(resolve, 2000));// Create another linkconst { data: secondLink } = await http.post<Link>({path: "/links",query: { workspaceId: workspace.workspaceId },- body: { url: "https://google.uk" },+ body: { url, domain },});// List links@@ -39,20 +42,80 @@ test("list links", async (ctx) => {expect(status).toEqual(200);expect(links.length).toEqual(2);- // expect(links[0]).toMatchObject({- // url: "https://google.uk",- // domain: "kiran.localhost",- // shortLink: `https://kiran.localhost/${firstLink.key}`,- // archived: false,- // // workspaceId: workspace.workspaceId,- // projectId: workspace.id,- // });- // expect(links[1]).toMatchObject({- // url: "https://google.com",- // domain: "kiran.localhost",- // shortLink: `https://kiran.localhost/${secondLink.key}`,- // archived: false,- // // workspaceId: workspace.workspaceId,- // projectId: workspace.id,- // });++ expect(links[0]).toMatchObject({+ id: expect.any(String),+ domain,+ url,+ key: expect.any(String),+ userId: user.id,+ projectId: workspace.id,+ workspaceId: workspace.workspaceId,+ archived: false,+ expiresAt: null,+ password: null,+ proxy: false,+ title: null,+ description: null,+ image: null,+ utm_source: null,+ utm_medium: null,+ utm_campaign: null,+ utm_term: null,+ utm_content: null,+ rewrite: false,+ ios: null,+ android: null,+ geo: null,+ publicStats: false,+ clicks: 0,+ lastClicked: null,+ checkDisabled: false,+ tagId: null,+ comments: null,+ tags: [],+ createdAt: expect.any(String),+ updatedAt: expect.any(String),+ shortLink: `https://${domain}/${secondLink.key}`,+ qrCode: `https://api.dub.co/qr?url=https://${domain}/${secondLink.key}`,+ user: JSON.parse(JSON.stringify(user)),+ });++ expect(links[1]).toMatchObject({+ id: expect.any(String),+ domain,+ url,+ key: expect.any(String),+ userId: user.id,+ projectId: workspace.id,+ workspaceId: workspace.workspaceId,+ archived: false,+ expiresAt: null,+ password: null,+ proxy: false,+ title: null,+ description: null,+ image: null,+ utm_source: null,+ utm_medium: null,+ utm_campaign: null,+ utm_term: null,+ utm_content: null,+ rewrite: false,+ ios: null,+ android: null,+ geo: null,+ publicStats: false,+ clicks: 0,+ lastClicked: null,+ checkDisabled: false,+ tagId: null,+ comments: null,+ tags: [],+ createdAt: expect.any(String),+ updatedAt: expect.any(String),+ shortLink: `https://${domain}/${firstLink.key}`,+ qrCode: `https://api.dub.co/qr?url=https://${domain}/${firstLink.key}`,+ user: JSON.parse(JSON.stringify(user)),+ });});