From fbf840bf6e75ae7eb12c0a6185e0fd1d50ef2409 Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Tue, 2 Dec 2025 00:55:12 -0600 Subject: [PATCH] test: update command generation tests to use mockResolvedValue - Changed mockReturnValue to mockResolvedValue for getBuildCommand in deployApplication tests, ensuring asynchronous command generation is handled correctly. - Added rollbackRegistryId, rollbackRegistry, and deployments fields to application settings in drop and traefik tests for improved rollback functionality. --- apps/dokploy/__test__/deploy/application.command.test.ts | 8 ++++---- apps/dokploy/__test__/drop/drop.test.ts | 3 +++ apps/dokploy/__test__/traefik/traefik.test.ts | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/dokploy/__test__/deploy/application.command.test.ts b/apps/dokploy/__test__/deploy/application.command.test.ts index a0c4387c8..be29748eb 100644 --- a/apps/dokploy/__test__/deploy/application.command.test.ts +++ b/apps/dokploy/__test__/deploy/application.command.test.ts @@ -189,7 +189,7 @@ describe("deployApplication - Command Generation Tests", () => { it("should verify nixpacks command is called with correct app", async () => { const mockNixpacksCommand = "nixpacks build /path/to/app --name test-app"; - vi.mocked(builders.getBuildCommand).mockReturnValue(mockNixpacksCommand); + vi.mocked(builders.getBuildCommand).mockResolvedValue(mockNixpacksCommand); await deployApplication({ applicationId: "test-app-id", @@ -220,7 +220,7 @@ describe("deployApplication - Command Generation Tests", () => { ); const mockRailpackCommand = "railpack prepare /path/to/app"; - vi.mocked(builders.getBuildCommand).mockReturnValue(mockRailpackCommand); + vi.mocked(builders.getBuildCommand).mockResolvedValue(mockRailpackCommand); await deployApplication({ applicationId: "test-app-id", @@ -241,7 +241,7 @@ describe("deployApplication - Command Generation Tests", () => { it("should execute commands in correct order", async () => { const mockNixpacksCommand = "nixpacks build"; - vi.mocked(builders.getBuildCommand).mockReturnValue(mockNixpacksCommand); + vi.mocked(builders.getBuildCommand).mockResolvedValue(mockNixpacksCommand); await deployApplication({ applicationId: "test-app-id", @@ -260,7 +260,7 @@ describe("deployApplication - Command Generation Tests", () => { it("should include log redirection in command", async () => { const mockCommand = "nixpacks build"; - vi.mocked(builders.getBuildCommand).mockReturnValue(mockCommand); + vi.mocked(builders.getBuildCommand).mockResolvedValue(mockCommand); await deployApplication({ applicationId: "test-app-id", diff --git a/apps/dokploy/__test__/drop/drop.test.ts b/apps/dokploy/__test__/drop/drop.test.ts index bd2d3c981..cabc77d87 100644 --- a/apps/dokploy/__test__/drop/drop.test.ts +++ b/apps/dokploy/__test__/drop/drop.test.ts @@ -41,6 +41,9 @@ const baseApp: ApplicationNested = { giteaRepository: "", cleanCache: false, watchPaths: [], + rollbackRegistryId: "", + rollbackRegistry: null, + deployments: [], enableSubmodules: false, applicationStatus: "done", triggerType: "push", diff --git a/apps/dokploy/__test__/traefik/traefik.test.ts b/apps/dokploy/__test__/traefik/traefik.test.ts index e6b98c3ba..279e74fa5 100644 --- a/apps/dokploy/__test__/traefik/traefik.test.ts +++ b/apps/dokploy/__test__/traefik/traefik.test.ts @@ -17,6 +17,9 @@ const baseApp: ApplicationNested = { giteaBuildPath: "", giteaId: "", args: [], + rollbackRegistryId: "", + rollbackRegistry: null, + deployments: [], cleanCache: false, applicationStatus: "done", endpointSpecSwarm: null,