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

Kiran K447a01bdb4c3
diff --git a/apps/web/tests/folders/index.test.ts b/apps/web/tests/folders/index.test.ts
index 18684ff78a..37532d063b 100644
--- a/apps/web/tests/folders/index.test.ts
+++ b/apps/web/tests/folders/index.test.ts
@@ -1,6 +1,5 @@
import z from "@/lib/zod";
import { FolderSchema } from "@/lib/zod/schemas/folders";
-import { Folder } from "@dub/prisma/client";
import { describe, expect, test } from "vitest";
import { IntegrationHarness } from "../utils/integration";
@@ -13,9 +12,11 @@ describe.sequential("/folders/**", async () => {
let folderCreated: FolderRecord | undefined;
test("POST /folders", async () => {
- const { status, data } = await http.post<Folder>({
+ const { status, data } = await http.post<FolderRecord>({
path: "/folders",
- query: { workspaceId: workspace.id },
+ query: {
+ workspaceId: workspace.id,
+ },
body: {
name: "Documents",
},
@@ -33,7 +34,9 @@ describe.sequential("/folders/**", async () => {
test("GET /folders", async () => {
const { status, data } = await http.get<FolderRecord[]>({
path: "/folders",
- query: { workspaceId: workspace.id },
+ query: {
+ workspaceId: workspace.id,
+ },
});
expect(status).toEqual(200);
@@ -43,7 +46,9 @@ describe.sequential("/folders/**", async () => {
test("PATCH /folders/{folderId}", { retry: 3 }, async () => {
const { status, data } = await http.patch<FolderRecord>({
path: `/folders/${folderCreated?.id}`,
- query: { workspaceId: workspace.id },
+ query: {
+ workspaceId: workspace.id,
+ },
body: {
name: "Documents-1",
},
@@ -59,7 +64,9 @@ describe.sequential("/folders/**", async () => {
test("DELETE /folders/{folderId}", async () => {
const { status, data } = await http.delete<{ id: string }>({
path: `/folders/${folderCreated?.id}`,
- query: { workspaceId: workspace.id },
+ query: {
+ workspaceId: workspace.id,
+ },
});
expect(status).toEqual(200);
diff --git a/apps/web/tests/links/create-link.test.ts b/apps/web/tests/links/create-link.test.ts
index 9b866a686f..4d7a47b145 100644
--- a/apps/web/tests/links/create-link.test.ts
+++ b/apps/web/tests/links/create-link.test.ts
@@ -399,7 +399,7 @@ describe.sequential("POST /links", async () => {
qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`,
});
- afterAll(async () => {
+ onTestFinished(async () => {
await Promise.all([h.deleteFolder(folder.id), h.deleteLink(link.id)]);
});
});
diff --git a/packages/prisma/schema/link.prisma b/packages/prisma/schema/link.prisma
index 8e904781be..7762662ad7 100644
--- a/packages/prisma/schema/link.prisma
+++ b/packages/prisma/schema/link.prisma
@@ -85,9 +85,9 @@ model Link {
@@index(createdAt(sort: Desc))
@@index(clicks(sort: Desc))
@@index(lastClicked)
+ @@index([programId])
@@index(userId)
@@index([folderId])
- @@index([programId])
@@index(tenantId)
@@fulltext([key, url])
}