diff --git a/apps/dokploy/__test__/deploy/application.command.test.ts b/apps/dokploy/__test__/deploy/application.command.test.ts index c81fab44c..1a33489b5 100644 --- a/apps/dokploy/__test__/deploy/application.command.test.ts +++ b/apps/dokploy/__test__/deploy/application.command.test.ts @@ -14,13 +14,18 @@ vi.mock("@dokploy/server/db", () => { set: vi.fn(() => chain), where: vi.fn(() => chain), returning: vi.fn().mockResolvedValue([{}] as any), + from: vi.fn(() => chain), + innerJoin: vi.fn(() => chain), + then: (resolve: (v: any) => void) => { + resolve([]); + }, } as any; return chain; }; return { db: { - select: vi.fn(), + select: vi.fn(() => createChainableMock()), insert: vi.fn(), update: vi.fn(() => createChainableMock()), delete: vi.fn(), @@ -31,6 +36,9 @@ vi.mock("@dokploy/server/db", () => { patch: { findMany: vi.fn().mockResolvedValue([]), }, + member: { + findMany: vi.fn().mockResolvedValue([]), + }, }, }, }; diff --git a/apps/dokploy/__test__/deploy/application.real.test.ts b/apps/dokploy/__test__/deploy/application.real.test.ts index 498281776..4adff6f07 100644 --- a/apps/dokploy/__test__/deploy/application.real.test.ts +++ b/apps/dokploy/__test__/deploy/application.real.test.ts @@ -15,13 +15,18 @@ vi.mock("@dokploy/server/db", () => { set: vi.fn(() => chain), where: vi.fn(() => chain), returning: vi.fn().mockResolvedValue([{}]), + from: vi.fn(() => chain), + innerJoin: vi.fn(() => chain), + then: (resolve: (v: any) => void) => { + resolve([]); + }, }; return chain; }; return { db: { - select: vi.fn(), + select: vi.fn(() => createChainableMock()), insert: vi.fn(), update: vi.fn(() => createChainableMock()), delete: vi.fn(), @@ -32,6 +37,9 @@ vi.mock("@dokploy/server/db", () => { patch: { findMany: vi.fn().mockResolvedValue([]), }, + member: { + findMany: vi.fn().mockResolvedValue([]), + }, }, }, }; diff --git a/apps/dokploy/__test__/setup.ts b/apps/dokploy/__test__/setup.ts index 5af01d147..04fd08b0c 100644 --- a/apps/dokploy/__test__/setup.ts +++ b/apps/dokploy/__test__/setup.ts @@ -12,7 +12,11 @@ vi.mock("@dokploy/server/db", () => { chain.where = () => chain; chain.values = () => chain; chain.returning = () => Promise.resolve([{}]); - chain.then = undefined; + chain.from = () => chain; + chain.innerJoin = () => chain; + chain.then = (resolve: (value: unknown) => void) => { + resolve([]); + }; const tableMock = { findFirst: vi.fn(() => Promise.resolve(undefined)), @@ -21,7 +25,6 @@ vi.mock("@dokploy/server/db", () => { update: vi.fn(() => chain), delete: vi.fn(() => chain), }; - const createQueryMock = () => tableMock; return { db: {