Skip to content

Commit c6006b5

Browse files
committed
test: add test case to libjxl.test.ts when input and output are not jxl
1 parent 178f009 commit c6006b5

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/converters/libjxl.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,29 @@ test("convert uses cjxl with output filetype being jxl", async () => {
8282
expect(command).toEqual("cjxl");
8383
expect(loggedMessage).toBe("stdout: Fake stdout");
8484
});
85+
86+
test("convert uses empty string as command with neither input nor output filetype being jxl", async () => {
87+
const originalConsoleLog = console.log;
88+
89+
let loggedMessage = "";
90+
console.log = (msg) => {
91+
loggedMessage = msg;
92+
};
93+
94+
const mockExecFile: ExecFileFn = (
95+
_cmd: string,
96+
_args: string[],
97+
callback: (err: ExecFileException | null, stdout: string, stderr: string) => void,
98+
) => {
99+
command = _cmd;
100+
callback(null, "Fake stdout", "");
101+
};
102+
103+
const result = await convert("input.png", "png", "jpg", "output.jpg", undefined, mockExecFile);
104+
105+
console.log = originalConsoleLog;
106+
107+
expect(result).toBe("Done");
108+
expect(command).toEqual("");
109+
expect(loggedMessage).toBe("stdout: Fake stdout");
110+
});

0 commit comments

Comments
 (0)