Files
ConvertX/tests/converters/vips.test.ts
Emrik Östling 2135c6b9f1 chore: use bun fmt and bun check (#685)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-10-23 18:23:49 +02:00

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"] },
]);
});