From 5ef431b9e93fd6b8886900ec5db16bf96a20c18d Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Wed, 18 Feb 2026 14:54:24 -0600 Subject: [PATCH] test: update mock implementation in application.real.test.ts - Replaced the mock for the patch service with a mock for db.query.patch.findMany to better simulate database behavior. - Added type and updatedAt fields to the mock patch object for improved test accuracy. --- apps/dokploy/__test__/deploy/application.real.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/dokploy/__test__/deploy/application.real.test.ts b/apps/dokploy/__test__/deploy/application.real.test.ts index 76b0b6354..c5dfe7caa 100644 --- a/apps/dokploy/__test__/deploy/application.real.test.ts +++ b/apps/dokploy/__test__/deploy/application.real.test.ts @@ -104,7 +104,6 @@ import * as adminService from "@dokploy/server/services/admin"; import * as applicationService from "@dokploy/server/services/application"; import { deployApplication } from "@dokploy/server/services/application"; import * as deploymentService from "@dokploy/server/services/deployment"; -import * as patchService from "@dokploy/server/services/patch"; import { mkdtemp, writeFile } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; @@ -554,8 +553,8 @@ describe( // 3. Patch content is the raw file content (not a diff) const newContent = "print('Patched App')\n"; - // 4. Mock patch service to return this patch - vi.mocked(patchService.findPatchesByEntityId).mockResolvedValue([ + // 4. Mock db.query.patch.findMany - generateApplyPatchesCommand uses this via findPatchesByEntityId + vi.mocked(db.query.patch.findMany).mockResolvedValue([ { patchId: "test-patch-1", applicationId: "test-app-id", @@ -563,7 +562,9 @@ describe( filePath: "app.py", content: newContent, enabled: true, + type: "update", createdAt: new Date().toISOString(), + updatedAt: new Date().toISOString(), } as any, ]);