From 8b5c14ca747b37c30a9c7654f48996770a297eef Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Tue, 1 Sep 2026 03:05:38 -0600 Subject: [PATCH] test: fix stale traefik remote-write test expectation writeTraefikConfigRemote moved from an execAsyncRemote echo command to writeFileRemote (SFTP) a while back; the test still mocked the old execAsyncRemote path and asserted on an echo command that no longer runs. --- .../traefik/write-app-traefik-config.test.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/dokploy/__test__/traefik/write-app-traefik-config.test.ts b/apps/dokploy/__test__/traefik/write-app-traefik-config.test.ts index 90c1ba60a..5b1babb2a 100644 --- a/apps/dokploy/__test__/traefik/write-app-traefik-config.test.ts +++ b/apps/dokploy/__test__/traefik/write-app-traefik-config.test.ts @@ -6,6 +6,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; const mocks = vi.hoisted(() => ({ execAsyncRemote: vi.fn(), + writeFileRemote: vi.fn(), })); vi.mock("@dokploy/server/utils/process/execAsync", async (importOriginal) => { @@ -16,6 +17,7 @@ vi.mock("@dokploy/server/utils/process/execAsync", async (importOriginal) => { return { ...actual, execAsyncRemote: mocks.execAsyncRemote, + writeFileRemote: mocks.writeFileRemote, }; }); @@ -91,7 +93,7 @@ describe("writeAppTraefikConfig", () => { }); it("writes the remote file when routers/services are present", async () => { - mocks.execAsyncRemote.mockResolvedValue({ stdout: "", stderr: "" }); + mocks.writeFileRemote.mockResolvedValue(undefined); await writeAppTraefikConfig( { @@ -109,8 +111,11 @@ describe("writeAppTraefikConfig", () => { "server-id", ); - expect(mocks.execAsyncRemote).toHaveBeenCalledOnce(); - const [, command] = mocks.execAsyncRemote.mock.calls[0] ?? []; - expect(command).toMatch(/^echo /); + expect(mocks.writeFileRemote).toHaveBeenCalledOnce(); + const [serverId, remotePath, content] = + mocks.writeFileRemote.mock.calls[0] ?? []; + expect(serverId).toBe("server-id"); + expect(remotePath).toContain("with-domain-app.yml"); + expect(content).toContain("with-domain-app-router-1"); }); });