From c6006b58d23aff7b23b1f1663f9a05c68d227b71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Krzeslak?= Date: Thu, 24 Jul 2025 19:53:22 +0200 Subject: [PATCH] test: add test case to libjxl.test.ts when input and output are not jxl --- tests/converters/libjxl.test.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/converters/libjxl.test.ts b/tests/converters/libjxl.test.ts index 7caf0bb..c591570 100644 --- a/tests/converters/libjxl.test.ts +++ b/tests/converters/libjxl.test.ts @@ -82,3 +82,29 @@ test("convert uses cjxl with output filetype being jxl", async () => { expect(command).toEqual("cjxl"); expect(loggedMessage).toBe("stdout: Fake stdout"); }); + +test("convert uses empty string as command with neither input nor output filetype being jxl", async () => { + const originalConsoleLog = console.log; + + let loggedMessage = ""; + console.log = (msg) => { + loggedMessage = msg; + }; + + const mockExecFile: ExecFileFn = ( + _cmd: string, + _args: string[], + callback: (err: ExecFileException | null, stdout: string, stderr: string) => void, + ) => { + command = _cmd; + callback(null, "Fake stdout", ""); + }; + + const result = await convert("input.png", "png", "jpg", "output.jpg", undefined, mockExecFile); + + console.log = originalConsoleLog; + + expect(result).toBe("Done"); + expect(command).toEqual(""); + expect(loggedMessage).toBe("stdout: Fake stdout"); +});