The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
wip
Kiran K512ae1860345
diff --git a/apps/web/tests/partners/analytics.test.ts b/apps/web/tests/partners/analytics.test.tsindex 1c48e54c42..e63cd47152 100644--- a/apps/web/tests/partners/analytics.test.ts+++ b/apps/web/tests/partners/analytics.test.ts@@ -1,12 +1,11 @@import z from "@/lib/zod";import { partnerAnalyticsResponseSchema } from "@/lib/zod/schemas/partners";-import { env } from "tests/utils/env";import { describe, expect, test } from "vitest";+import { env } from "../utils/env";import { IntegrationHarness } from "../utils/integration";+import { E2E_PARTNER_ID, E2E_PROGRAM } from "../utils/resource";const allowedGroupBy = ["count", "timeseries", "top_links"];-const programId = "prog_CYCu7IMAapjkRpTnr8F1azjN";-const partnerId = "pn_H4TB2V5hDIjpqB7PwrxESoY3";describe.runIf(env.CI).sequential("GET /partners/analytics", async () => {const h = new IntegrationHarness();@@ -15,13 +14,13 @@ describe.runIf(env.CI).sequential("GET /partners/analytics", async () => {allowedGroupBy.map((groupBy) => {test(`by ${groupBy}`, async () => {const { status, data } = await http.get<any[]>({- path: `/partners/analytics`,+ path: "/partners/analytics",query: {groupBy,event: "composite",interval: "30d",- programId,- partnerId,+ programId: E2E_PROGRAM.id,+ partnerId: E2E_PARTNER_ID,},});diff --git a/apps/web/tests/partners/create-partner-link.test.ts b/apps/web/tests/partners/create-partner-link.test.tsnew file mode 100644index 0000000000..dbf51c1575--- /dev/null+++ b/apps/web/tests/partners/create-partner-link.test.ts@@ -0,0 +1,31 @@+import { Link } from "@dub/prisma/client";+import { expect, onTestFinished, test } from "vitest";+import { env } from "../utils/env";+import { randomId } from "../utils/helpers";+import { IntegrationHarness } from "../utils/integration";+import { E2E_PARTNER_ID, E2E_PROGRAM } from "../utils/resource";+import { expectedLink, LinkSchema } from "../utils/schema";++test.skipIf(env.CI)("POST /api/partners/links", async () => {+ const h = new IntegrationHarness();+ const { http } = await h.init();++ onTestFinished(async () => {+ await h.deleteLink(link.id);+ });++ const { status, data: link } = await http.post<Link>({+ path: "/partners/links",+ body: {+ programId: E2E_PROGRAM.id,+ partnerId: E2E_PARTNER_ID,+ tenantId: randomId(),+ },+ });++ expect(status).toEqual(200);+ expect(LinkSchema.strict().parse(link)).toBeTruthy();+ expect(link).toStrictEqual({+ ...expectedLink,+ });+});diff --git a/apps/web/tests/partners/create-partner.test.ts b/apps/web/tests/partners/create-partner.test.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/apps/web/tests/utils/resource.ts b/apps/web/tests/utils/resource.tsindex dc15287ee5..09dc089ba4 100644--- a/apps/web/tests/utils/resource.ts+++ b/apps/web/tests/utils/resource.ts@@ -45,3 +45,12 @@ export const E2E_DISCOUNT = {couponId: "XZuejd0Q",couponTestId: "2NMXz81x",};++// Program+export const E2E_PROGRAM = {+ id: "prog_CYCu7IMAapjkRpTnr8F1azjN",+ domain: "getacme.link",+ url: "https://acme.com",+};++export const E2E_PARTNER_ID = "pn_H4TB2V5hDIjpqB7PwrxESoY3";