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 test cases for link creation error scenarios with folder permissions

Kiran Kb242980032a2
diff --git a/apps/web/tests/links/create-link-error.test.ts b/apps/web/tests/links/create-link-error.test.ts
index 93263796d3..4e492dc7a5 100644
--- a/apps/web/tests/links/create-link-error.test.ts
+++ b/apps/web/tests/links/create-link-error.test.ts
@@ -60,6 +60,42 @@ const cases = [
},
},
},
+ {
+ name: "create link in folder that doesn't exist",
+ body: {
+ domain,
+ url,
+ folderId: "fold_xxx",
+ },
+ expected: {
+ status: 404,
+ data: {
+ error: {
+ code: "not_found",
+ message: "Folder not found.",
+ doc_url: "https://dub.co/docs/api-reference/errors#not-found",
+ },
+ },
+ },
+ },
+ {
+ name: "create link in folder without write access",
+ body: {
+ domain,
+ url,
+ folderId: "fold_ftco6wsIwww96iWv7yJig8w2", // Kiran's folder
+ },
+ expected: {
+ status: 403,
+ data: {
+ error: {
+ code: "forbidden",
+ message: "You are not allowed to perform this action on this folder.",
+ doc_url: "https://dub.co/docs/api-reference/errors#forbidden",
+ },
+ },
+ },
+ },
];
cases.forEach(({ name, body, expected }) => {