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 bulk create links with folder test

Steven Teyb73881256150
diff --git a/apps/web/tests/links/folder-link-access.test.ts b/apps/web/tests/links/folder-link-access.test.ts
index d65aeae2a9..763f5c1ef5 100644
--- a/apps/web/tests/links/folder-link-access.test.ts
+++ b/apps/web/tests/links/folder-link-access.test.ts
@@ -1,4 +1,5 @@
import { Link } from "@dub/prisma/client";
+import { expectedLink } from "tests/utils/schema";
import { describe, expect, test } from "vitest";
import { IntegrationHarness } from "../utils/integration";
import {
@@ -7,6 +8,7 @@ import {
E2E_NO_ACCESS_FOLDER_LINK_ID,
E2E_READ_ONLY_FOLDER_ID,
E2E_READ_ONLY_FOLDER_LINK_ID,
+ E2E_WRITE_ACCESS_FOLDER_ID,
} from "../utils/resource";
const { domain, url } = E2E_LINK;
@@ -17,6 +19,34 @@ describe.concurrent("Folder access permissions", async () => {
describe("create link in a folder", async () => {
const cases = [
+ {
+ name: "with write access",
+ body: {
+ domain,
+ url,
+ folderId: E2E_WRITE_ACCESS_FOLDER_ID,
+ },
+ expected: {
+ status: 200,
+ data: {
+ ...expectedLink,
+ url,
+ domain,
+ folderId: E2E_WRITE_ACCESS_FOLDER_ID,
+ userId: expect.any(String),
+ projectId: expect.any(String),
+ workspaceId: expect.any(String),
+ shortLink: expect.stringMatching(
+ new RegExp(`https://${domain}/.*`),
+ ),
+ qrCode: expect.stringMatching(
+ new RegExp(
+ `https://api.dub.co/qr\\?url=https://${domain}/.*\\?qr=1`,
+ ),
+ ),
+ },
+ },
+ },
{
name: "that doesn't exist",
body: {
diff --git a/apps/web/tests/utils/resource.ts b/apps/web/tests/utils/resource.ts
index 6b4861a396..28a3c2661f 100644
--- a/apps/web/tests/utils/resource.ts
+++ b/apps/web/tests/utils/resource.ts
@@ -24,6 +24,7 @@ export const E2E_CUSTOMER_EXTERNAL_ID = "cus_jTrfVKYN3Buc3F80JoqBiY0g";
export const E2E_WEBHOOK_ID = "wh_MHR7sZXXtZ7keBaNYZ30rQ0v";
// Folders specific
+export const E2E_WRITE_ACCESS_FOLDER_ID = "fold_stp7lRJOs7RLKlaVcTVPS74P"; // Folder with write access
export const E2E_READ_ONLY_FOLDER_ID = "fold_0lo6YZoVBvAyFg62SKTgDXTT"; // Folder with read-only access
export const E2E_NO_ACCESS_FOLDER_ID = "fold_zRbQG7RSPEWZS71MxJNCIF2m"; // Folder with no access