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 Tey9e77d9164c6b
diff --git a/apps/web/tests/analytics/clicks.test.ts b/apps/web/tests/analytics/clicks.test.ts
index 31b4cb50e9..58593cfd5b 100644
--- a/apps/web/tests/analytics/clicks.test.ts
+++ b/apps/web/tests/analytics/clicks.test.ts
@@ -38,4 +38,22 @@ describe.runIf(env.CI).sequential("GET /analytics/clicks", async () => {
expect(parsed.success).toBeTruthy();
});
});
+
+ // deprecated, backwards compatiblity
+ VALID_TINYBIRD_ENDPOINTS.map((endpoint) => {
+ test(`by ${endpoint}`, async () => {
+ const { status, data } = await http.get<any[]>({
+ path: `/analytics/${endpoint}`,
+ query: { workspaceId, ...filter },
+ });
+
+ const parsed = z
+ .array(getClickAnalyticsResponse[endpoint].strict())
+ .safeParse(data);
+
+ expect(status).toEqual(200);
+ expect(data.length).toBeGreaterThanOrEqual(0);
+ expect(parsed.success).toBeTruthy();
+ });
+ });
});
diff --git a/apps/web/tests/analytics/deprecated/browser.test.ts b/apps/web/tests/analytics/deprecated/browser.test.ts
deleted file mode 100644
index b9f237da84..0000000000
--- a/apps/web/tests/analytics/deprecated/browser.test.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import z from "@/lib/zod";
-import { getClickAnalyticsResponse } from "@/lib/zod/schemas";
-import { expect, test } from "vitest";
-import { env } from "../../utils/env";
-import { IntegrationHarness } from "../../utils/integration";
-import { filter } from "../utils";
-
-test.runIf(env.CI)("GET /analytics/browser", async (ctx) => {
- const h = new IntegrationHarness(ctx);
- const { workspace, http } = await h.init();
- const { workspaceId } = workspace;
-
- const { status, data } = await http.get<any[]>({
- path: "/analytics/browser",
- query: { workspaceId, ...filter },
- });
-
- const parsed = z
- .array(getClickAnalyticsResponse["browser"].strict())
- .safeParse(data);
-
- expect(status).toEqual(200);
- expect(data.length).toBeGreaterThanOrEqual(0);
- expect(parsed.success).toBeTruthy();
-});
diff --git a/apps/web/tests/analytics/deprecated/city.test.ts b/apps/web/tests/analytics/deprecated/city.test.ts
deleted file mode 100644
index e60250aaa4..0000000000
--- a/apps/web/tests/analytics/deprecated/city.test.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import z from "@/lib/zod";
-import { getClickAnalyticsResponse } from "@/lib/zod/schemas";
-import { expect, test } from "vitest";
-import { env } from "../../utils/env";
-import { IntegrationHarness } from "../../utils/integration";
-import { filter } from "../utils";
-
-test.runIf(env.CI)("GET /analytics/city", async (ctx) => {
- const h = new IntegrationHarness(ctx);
- const { workspace, http } = await h.init();
- const { workspaceId } = workspace;
-
- const { status, data } = await http.get<any[]>({
- path: "/analytics/city",
- query: { workspaceId, ...filter },
- });
-
- const parsed = z
- .array(getClickAnalyticsResponse["city"].strict())
- .safeParse(data);
-
- expect(status).toEqual(200);
- expect(data.length).toBeGreaterThanOrEqual(0);
- expect(parsed.success).toBeTruthy();
-});
diff --git a/apps/web/tests/analytics/deprecated/country.test.ts b/apps/web/tests/analytics/deprecated/country.test.ts
deleted file mode 100644
index 60db5694e5..0000000000
--- a/apps/web/tests/analytics/deprecated/country.test.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import z from "@/lib/zod";
-import { getClickAnalyticsResponse } from "@/lib/zod/schemas";
-import { expect, test } from "vitest";
-import { env } from "../../utils/env";
-import { IntegrationHarness } from "../../utils/integration";
-import { filter } from "../utils";
-
-test.runIf(env.CI)("GET /analytics/country", async (ctx) => {
- const h = new IntegrationHarness(ctx);
- const { workspace, http } = await h.init();
- const { workspaceId } = workspace;
-
- const { status, data } = await http.get<any[]>({
- path: "/analytics/country",
- query: { workspaceId, ...filter },
- });
-
- const parsed = z
- .array(getClickAnalyticsResponse["country"].strict())
- .safeParse(data);
-
- expect(status).toEqual(200);
- expect(data.length).toBeGreaterThanOrEqual(0);
- expect(parsed.success).toBeTruthy();
-});
diff --git a/apps/web/tests/analytics/deprecated/device.test.ts b/apps/web/tests/analytics/deprecated/device.test.ts
deleted file mode 100644
index 8ae7778283..0000000000
--- a/apps/web/tests/analytics/deprecated/device.test.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import z from "@/lib/zod";
-import { getClickAnalyticsResponse } from "@/lib/zod/schemas";
-import { expect, test } from "vitest";
-import { env } from "../../utils/env";
-import { IntegrationHarness } from "../../utils/integration";
-import { filter } from "../utils";
-
-test.runIf(env.CI)("GET /analytics/device", async (ctx) => {
- const h = new IntegrationHarness(ctx);
- const { workspace, http } = await h.init();
- const { workspaceId } = workspace;
-
- const { status, data } = await http.get<any[]>({
- path: "/analytics/device",
- query: { workspaceId, ...filter },
- });
-
- const parsed = z
- .array(getClickAnalyticsResponse["device"].strict())
- .safeParse(data);
-
- expect(status).toEqual(200);
- expect(data.length).toBeGreaterThanOrEqual(0);
- expect(parsed.success).toBeTruthy();
-});
diff --git a/apps/web/tests/analytics/deprecated/os.test.ts b/apps/web/tests/analytics/deprecated/os.test.ts
deleted file mode 100644
index 938fd0e098..0000000000
--- a/apps/web/tests/analytics/deprecated/os.test.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import z from "@/lib/zod";
-import { getClickAnalyticsResponse } from "@/lib/zod/schemas";
-import { expect, test } from "vitest";
-import { env } from "../../utils/env";
-import { IntegrationHarness } from "../../utils/integration";
-import { filter } from "../utils";
-
-test.runIf(env.CI)("GET /analytics/os", async (ctx) => {
- const h = new IntegrationHarness(ctx);
- const { workspace, http } = await h.init();
- const { workspaceId } = workspace;
-
- const { status, data } = await http.get<any[]>({
- path: "/analytics/os",
- query: { workspaceId, ...filter },
- });
-
- const parsed = z
- .array(getClickAnalyticsResponse["os"].strict())
- .safeParse(data);
-
- expect(status).toEqual(200);
- expect(data.length).toBeGreaterThanOrEqual(0);
- expect(parsed.success).toBeTruthy();
-});
diff --git a/apps/web/tests/analytics/deprecated/referer.test.ts b/apps/web/tests/analytics/deprecated/referer.test.ts
deleted file mode 100644
index 017d2dafb5..0000000000
--- a/apps/web/tests/analytics/deprecated/referer.test.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import z from "@/lib/zod";
-import { getClickAnalyticsResponse } from "@/lib/zod/schemas";
-import { expect, test } from "vitest";
-import { env } from "../../utils/env";
-import { IntegrationHarness } from "../../utils/integration";
-import { filter } from "../utils";
-
-test.runIf(env.CI)("GET /analytics/referer", async (ctx) => {
- const h = new IntegrationHarness(ctx);
- const { workspace, http } = await h.init();
- const { workspaceId } = workspace;
-
- const { status, data } = await http.get<any[]>({
- path: "/analytics/referer",
- query: { workspaceId, ...filter },
- });
-
- const parsed = z
- .array(getClickAnalyticsResponse["referer"].strict())
- .safeParse(data);
-
- expect(status).toEqual(200);
- expect(data.length).toBeGreaterThanOrEqual(0);
- expect(parsed.success).toBeTruthy();
-});
diff --git a/apps/web/tests/analytics/deprecated/timeseries.test.ts b/apps/web/tests/analytics/deprecated/timeseries.test.ts
deleted file mode 100644
index 5596ecbcf5..0000000000
--- a/apps/web/tests/analytics/deprecated/timeseries.test.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import z from "@/lib/zod";
-import { getClickAnalyticsResponse } from "@/lib/zod/schemas";
-import { expect, test } from "vitest";
-import { env } from "../../utils/env";
-import { IntegrationHarness } from "../../utils/integration";
-import { filter } from "../utils";
-
-test.runIf(env.CI)("GET /analytics/timeseries", async (ctx) => {
- const h = new IntegrationHarness(ctx);
- const { workspace, http } = await h.init();
- const { workspaceId } = workspace;
-
- const { status, data } = await http.get<any[]>({
- path: "/analytics/timeseries",
- query: { workspaceId, ...filter },
- });
-
- const parsed = z
- .array(getClickAnalyticsResponse["timeseries"].strict())
- .safeParse(data);
-
- expect(status).toEqual(200);
- expect(data.length).toBeGreaterThanOrEqual(0);
- expect(parsed.success).toBeTruthy();
-});
diff --git a/apps/web/tests/analytics/deprecated/top-links.test.ts b/apps/web/tests/analytics/deprecated/top-links.test.ts
deleted file mode 100644
index f3fb1cc0a4..0000000000
--- a/apps/web/tests/analytics/deprecated/top-links.test.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import z from "@/lib/zod";
-import { getClickAnalyticsResponse } from "@/lib/zod/schemas";
-import { expect, test } from "vitest";
-import { env } from "../../utils/env";
-import { IntegrationHarness } from "../../utils/integration";
-import { filter } from "../utils";
-
-test.runIf(env.CI)("GET /analytics/top_links", async (ctx) => {
- const h = new IntegrationHarness(ctx);
- const { workspace, http } = await h.init();
- const { workspaceId } = workspace;
-
- const { status, data } = await http.get<any[]>({
- path: "/analytics/top_links",
- query: { workspaceId, ...filter },
- });
-
- const parsed = z
- .array(getClickAnalyticsResponse["top_links"].strict())
- .safeParse(data);
-
- expect(status).toEqual(200);
- expect(data.length).toBeGreaterThanOrEqual(0);
- expect(parsed.success).toBeTruthy();
-});
diff --git a/apps/web/tests/analytics/deprecated/top-urls.test.ts b/apps/web/tests/analytics/deprecated/top-urls.test.ts
deleted file mode 100644
index cf0ed7cd5d..0000000000
--- a/apps/web/tests/analytics/deprecated/top-urls.test.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import z from "@/lib/zod";
-import { getClickAnalyticsResponse } from "@/lib/zod/schemas";
-import { expect, test } from "vitest";
-import { env } from "../../utils/env";
-import { IntegrationHarness } from "../../utils/integration";
-import { filter } from "../utils";
-
-test.runIf(env.CI)("GET /analytics/top_urls", async (ctx) => {
- const h = new IntegrationHarness(ctx);
- const { workspace, http } = await h.init();
- const { workspaceId } = workspace;
-
- const { status, data } = await http.get<any[]>({
- path: "/analytics/top_urls",
- query: { workspaceId, ...filter },
- });
-
- const parsed = z
- .array(getClickAnalyticsResponse["top_urls"].strict())
- .safeParse(data);
-
- expect(status).toEqual(200);
- expect(data.length).toBeGreaterThanOrEqual(0);
- expect(parsed.success).toBeTruthy();
-});