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.

with record clicks checks

Kiran K067db024d928
diff --git a/apps/web/tests/redirects/index.test.ts b/apps/web/tests/redirects/index.test.ts
index e883a18583..332426a837 100644
--- a/apps/web/tests/redirects/index.test.ts
+++ b/apps/web/tests/redirects/index.test.ts
@@ -13,6 +13,7 @@ const fetchOptions: RequestInit = {
describe.runIf(env.CI)("Link Redirects", async () => {
const h = new IntegrationHarness();
+ const { workspace, http } = await h.init();
test("root", async () => {
const response = await fetch(h.baseUrl, fetchOptions);
@@ -77,4 +78,41 @@ describe.runIf(env.CI)("Link Redirects", async () => {
expect(response.headers.get("x-powered-by")).toBe(poweredBy);
expect(response.status).toBe(302);
});
+
+ test("with record clicks check", async () => {
+ const key = "checkly-check-clicks";
+
+ const {
+ data: { clicks: previousClicks },
+ } = await http.get<{ clicks: number }>({
+ path: "/analytics",
+ query: {
+ event: "clicks",
+ workspaceId: workspace.id,
+ domain: "dub.sh",
+ key,
+ interval: "all_unfiltered",
+ },
+ });
+
+ await fetch(`${h.baseUrl}/checkly-check-clicks`, {
+ ...fetchOptions,
+ headers: {},
+ });
+
+ const {
+ data: { clicks: updatedClicks },
+ } = await http.get<{ clicks: number }>({
+ path: "/analytics",
+ query: {
+ event: "clicks",
+ workspaceId: workspace.id,
+ domain: "dub.sh",
+ key,
+ interval: "all_unfiltered",
+ },
+ });
+
+ expect(updatedClicks).toBe(previousClicks + 1);
+ });
});