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.

Add analytics filter to tests

Kiran K6197d54521e2
diff --git a/apps/web/tests/analytics/browser.test.ts b/apps/web/tests/analytics/browser.test.ts
index 52d604a8f5..519a636137 100644
--- a/apps/web/tests/analytics/browser.test.ts
+++ b/apps/web/tests/analytics/browser.test.ts
@@ -3,6 +3,7 @@ import { analyticsResponseSchema } 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);
@@ -11,7 +12,7 @@ test.runIf(env.CI)("GET /analytics/browser", async (ctx) => {
const { status, data } = await http.get<any[]>({
path: "/analytics/browser",
- query: { workspaceId },
+ query: { workspaceId, ...filter },
});
expect(status).toEqual(200);
diff --git a/apps/web/tests/analytics/city.test.ts b/apps/web/tests/analytics/city.test.ts
index fb2348ad4f..815a91e463 100644
--- a/apps/web/tests/analytics/city.test.ts
+++ b/apps/web/tests/analytics/city.test.ts
@@ -3,6 +3,7 @@ import { analyticsResponseSchema } 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);
@@ -11,7 +12,7 @@ test.runIf(env.CI)("GET /analytics/city", async (ctx) => {
const { status, data } = await http.get<any[]>({
path: "/analytics/city",
- query: { workspaceId },
+ query: { workspaceId, ...filter },
});
expect(status).toEqual(200);
diff --git a/apps/web/tests/analytics/clicks.test.ts b/apps/web/tests/analytics/clicks.test.ts
index d17882dbc7..710e3a7517 100644
--- a/apps/web/tests/analytics/clicks.test.ts
+++ b/apps/web/tests/analytics/clicks.test.ts
@@ -1,6 +1,7 @@
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/clicks", async (ctx) => {
const h = new IntegrationHarness(ctx);
@@ -9,7 +10,7 @@ test.runIf(env.CI)("GET /analytics/clicks", async (ctx) => {
const { status, data: clicks } = await http.get<number>({
path: "/analytics/clicks",
- query: { workspaceId },
+ query: { workspaceId, ...filter },
});
expect(status).toEqual(200);
diff --git a/apps/web/tests/analytics/country.test.ts b/apps/web/tests/analytics/country.test.ts
index 9d11983710..4ba192e139 100644
--- a/apps/web/tests/analytics/country.test.ts
+++ b/apps/web/tests/analytics/country.test.ts
@@ -3,6 +3,7 @@ import { analyticsResponseSchema } 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);
@@ -11,7 +12,7 @@ test.runIf(env.CI)("GET /analytics/country", async (ctx) => {
const { status, data } = await http.get<any[]>({
path: "/analytics/country",
- query: { workspaceId },
+ query: { workspaceId, ...filter },
});
expect(status).toEqual(200);
diff --git a/apps/web/tests/analytics/device.test.ts b/apps/web/tests/analytics/device.test.ts
index c625425eec..b6ca460dab 100644
--- a/apps/web/tests/analytics/device.test.ts
+++ b/apps/web/tests/analytics/device.test.ts
@@ -3,6 +3,7 @@ import { analyticsResponseSchema } 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);
@@ -11,7 +12,7 @@ test.runIf(env.CI)("GET /analytics/device", async (ctx) => {
const { status, data } = await http.get<any[]>({
path: "/analytics/device",
- query: { workspaceId },
+ query: { workspaceId, ...filter },
});
expect(status).toEqual(200);
diff --git a/apps/web/tests/analytics/os.test.ts b/apps/web/tests/analytics/os.test.ts
index d8ee04da7b..3dad2261e3 100644
--- a/apps/web/tests/analytics/os.test.ts
+++ b/apps/web/tests/analytics/os.test.ts
@@ -3,6 +3,7 @@ import { analyticsResponseSchema } 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);
@@ -11,7 +12,7 @@ test.runIf(env.CI)("GET /analytics/os", async (ctx) => {
const { status, data } = await http.get<any[]>({
path: "/analytics/os",
- query: { workspaceId },
+ query: { workspaceId, ...filter },
});
expect(status).toEqual(200);
diff --git a/apps/web/tests/analytics/referer.test.ts b/apps/web/tests/analytics/referer.test.ts
index 8afb096b56..41aa4eacfc 100644
--- a/apps/web/tests/analytics/referer.test.ts
+++ b/apps/web/tests/analytics/referer.test.ts
@@ -3,6 +3,7 @@ import { analyticsResponseSchema } 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);
@@ -11,7 +12,7 @@ test.runIf(env.CI)("GET /analytics/referer", async (ctx) => {
const { status, data } = await http.get<any[]>({
path: "/analytics/referer",
- query: { workspaceId },
+ query: { workspaceId, ...filter },
});
expect(status).toEqual(200);
diff --git a/apps/web/tests/analytics/timeseries.test.ts b/apps/web/tests/analytics/timeseries.test.ts
index 05ba797f06..8a5daa684b 100644
--- a/apps/web/tests/analytics/timeseries.test.ts
+++ b/apps/web/tests/analytics/timeseries.test.ts
@@ -3,6 +3,7 @@ import { analyticsResponseSchema } 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);
@@ -11,7 +12,7 @@ test.runIf(env.CI)("GET /analytics/timeseries", async (ctx) => {
const { status, data } = await http.get<any[]>({
path: "/analytics/timeseries",
- query: { workspaceId },
+ query: { workspaceId, ...filter },
});
expect(status).toEqual(200);
diff --git a/apps/web/tests/analytics/top-links.test.ts b/apps/web/tests/analytics/top-links.test.ts
index cd5de89933..ef1eaa4fb5 100644
--- a/apps/web/tests/analytics/top-links.test.ts
+++ b/apps/web/tests/analytics/top-links.test.ts
@@ -3,6 +3,7 @@ import { analyticsResponseSchema } 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);
@@ -11,7 +12,7 @@ test.runIf(env.CI)("GET /analytics/top_links", async (ctx) => {
const { status, data } = await http.get<any[]>({
path: "/analytics/top_links",
- query: { workspaceId },
+ query: { workspaceId, ...filter },
});
expect(status).toEqual(200);
diff --git a/apps/web/tests/analytics/top-urls.test.ts b/apps/web/tests/analytics/top-urls.test.ts
index 184298cff6..ba6f166884 100644
--- a/apps/web/tests/analytics/top-urls.test.ts
+++ b/apps/web/tests/analytics/top-urls.test.ts
@@ -3,6 +3,7 @@ import { analyticsResponseSchema } 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);
@@ -11,7 +12,7 @@ test.runIf(env.CI)("GET /analytics/top_urls", async (ctx) => {
const { status, data } = await http.get<any[]>({
path: "/analytics/top_urls",
- query: { workspaceId },
+ query: { workspaceId, ...filter },
});
expect(status).toEqual(200);
diff --git a/apps/web/tests/analytics/utils.ts b/apps/web/tests/analytics/utils.ts
new file mode 100644
index 0000000000..ea5c418717
--- /dev/null
+++ b/apps/web/tests/analytics/utils.ts
@@ -0,0 +1,5 @@
+export const filter = {
+ domain: "dub.sh",
+ key: "dummy",
+ interval: "30d",
+};