mirror of
https://github.com/C4illin/ConvertX.git
synced 2026-10-28 07:44:21 +01:00
2135c6b9f1
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
26 lines
897 B
TypeScript
26 lines
897 B
TypeScript
import { expect, test } from "bun:test";
|
|
|
|
import { convert } from "../../src/converters/vips";
|
|
import { runCommonTests } from "./helpers/commonTests";
|
|
import { createMockExecFile } from "./helpers/converters";
|
|
|
|
runCommonTests(convert);
|
|
|
|
test("uses the pdfload action for pdf input", async () => {
|
|
const { execFile, calls } = createMockExecFile();
|
|
|
|
await convert("in/doc.pdf", "pdf", "png", "out/doc.png", undefined, execFile);
|
|
|
|
expect(calls).toEqual([{ cmd: "vips", args: ["pdfload", "in/doc.pdf", "out/doc.png"] }]);
|
|
});
|
|
|
|
test.each(["jpeg", "png", "svg", "tiff"])("uses the copy action for %s input", async (fileType) => {
|
|
const { execFile, calls } = createMockExecFile();
|
|
|
|
await convert(`in/image.${fileType}`, fileType, "webp", "out/image.webp", undefined, execFile);
|
|
|
|
expect(calls).toEqual([
|
|
{ cmd: "vips", args: ["copy", `in/image.${fileType}`, "out/image.webp"] },
|
|
]);
|
|
});
|