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 Teya2d286f34718
diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml
index 42e4010a6c..74e25162e6 100644
--- a/.github/workflows/e2e.yaml
+++ b/.github/workflows/e2e.yaml
@@ -36,9 +36,6 @@ jobs:
E2E_BASE_URL: ${{ github.event.deployment_status.environment_url }}
E2E_TOKEN: ${{ secrets.E2E_TOKEN }}
E2E_TOKEN_OLD: ${{ secrets.E2E_TOKEN_OLD }}
- E2E_USER_ID: ${{ secrets.E2E_USER_ID }}
- E2E_USER_ID_OLD: ${{ secrets.E2E_USER_ID_OLD }}
- E2E_WORKSPACE_ID: ${{ secrets.E2E_WORKSPACE_ID }}
QSTASH_TOKEN: ${{ secrets.QSTASH_TOKEN }}
QSTASH_CURRENT_SIGNING_KEY: ${{ secrets.QSTASH_CURRENT_SIGNING_KEY }}
NEXT_PUBLIC_NGROK_URL: ${{ github.event.deployment_status.environment_url }}
diff --git a/apps/web/lib/api/links/bulk-create-links.ts b/apps/web/lib/api/links/bulk-create-links.ts
index 6dffe6d862..d1335ccb9b 100644
--- a/apps/web/lib/api/links/bulk-create-links.ts
+++ b/apps/web/lib/api/links/bulk-create-links.ts
@@ -7,7 +7,11 @@ import { createId } from "../utils";
import { includeTags } from "./include-tags";
import { propagateBulkLinkChanges } from "./propagate-bulk-link-changes";
import { updateLinksUsage } from "./update-links-usage";
-import { checkIfLinksHaveTags, checkIfLinksHaveWebhooks } from "./utils";
+import {
+ checkIfLinksHaveTags,
+ checkIfLinksHaveWebhooks,
+ transformLink,
+} from "./utils";
export async function bulkCreateLinks({
links,
@@ -192,5 +196,5 @@ export async function bulkCreateLinks({
]),
);
- return finalCreatedLinks;
+ return finalCreatedLinks.map(transformLink);
}
diff --git a/apps/web/tests/utils/env.ts b/apps/web/tests/utils/env.ts
index 5b6e2d104e..75c0c685ce 100644
--- a/apps/web/tests/utils/env.ts
+++ b/apps/web/tests/utils/env.ts
@@ -4,9 +4,6 @@ export const integrationTestEnv = z.object({
E2E_BASE_URL: z.string().url().min(1),
E2E_TOKEN: z.string().min(1),
E2E_TOKEN_OLD: z.string().min(1),
- E2E_USER_ID: z.string().min(1),
- E2E_USER_ID_OLD: z.string().min(1),
- E2E_WORKSPACE_ID: z.string().min(1),
CI: z.coerce
.string()
.default("false")
diff --git a/apps/web/tests/utils/integration-old.ts b/apps/web/tests/utils/integration-old.ts
index a1805edcd9..5763b8ab2a 100644
--- a/apps/web/tests/utils/integration-old.ts
+++ b/apps/web/tests/utils/integration-old.ts
@@ -3,6 +3,7 @@ import { type TaskContext } from "vitest";
import { z } from "zod";
import { env, integrationTestEnv } from "./env";
import { HttpClient } from "./http";
+import { E2E_USER_ID, E2E_WORKSPACE_ID } from "./resource";
interface Resources {
user: Pick<User, "id">;
@@ -31,7 +32,7 @@ export class IntegrationHarnessOld {
async init() {
const user = {
- id: this.env.E2E_USER_ID,
+ id: E2E_USER_ID,
};
const apiKey = {
@@ -39,7 +40,7 @@ export class IntegrationHarnessOld {
};
const workspace = {
- id: this.env.E2E_WORKSPACE_ID,
+ id: E2E_WORKSPACE_ID,
slug: "acme",
name: "Acme, Inc.",
};
diff --git a/apps/web/tests/utils/integration.ts b/apps/web/tests/utils/integration.ts
index 517fc88800..8e719ac26e 100644
--- a/apps/web/tests/utils/integration.ts
+++ b/apps/web/tests/utils/integration.ts
@@ -3,6 +3,7 @@ import { type TaskContext } from "vitest";
import { z } from "zod";
import { HttpClient } from "../utils/http";
import { env, integrationTestEnv } from "./env";
+import { E2E_USER_ID, E2E_WORKSPACE_ID } from "./resource";
interface Resources {
user: Pick<User, "id">;
@@ -31,7 +32,7 @@ export class IntegrationHarness {
async init() {
const user = {
- id: this.env.E2E_USER_ID,
+ id: E2E_USER_ID,
};
const apiKey = {
@@ -39,7 +40,7 @@ export class IntegrationHarness {
};
const workspace = {
- id: this.env.E2E_WORKSPACE_ID,
+ id: E2E_WORKSPACE_ID,
slug: "acme",
name: "Acme, Inc.",
webhookEnabled: true,
diff --git a/apps/web/tests/utils/resource.ts b/apps/web/tests/utils/resource.ts
index 7993599577..d7752244f1 100644
--- a/apps/web/tests/utils/resource.ts
+++ b/apps/web/tests/utils/resource.ts
@@ -1,3 +1,6 @@
+export const E2E_USER_ID = "cludszk1h0000wmd2e0ea2b0p";
+export const E2E_WORKSPACE_ID = "ws_clrei1gld0002vs9mzn93p8ik";
+
export const E2E_LINK = {
domain: "dub.sh",
url: "https://github.com/dubinc",