test: add unit test for libheif.ts

This commit is contained in:
Jörg Krzeslak 2025-07-24 14:35:42 +02:00
parent 7524f304fe
commit 5957873534
2 changed files with 22 additions and 2 deletions

View file

@ -1,4 +1,5 @@
import { execFile } from "child_process";
import { execFile as execFileOriginal } from "child_process";
import { ExecFileFn } from "./types.ts";
export const properties = {
from: {
@ -14,8 +15,8 @@ export function convert(
fileType: string,
convertTo: string,
targetPath: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
execFile: ExecFileFn = execFileOriginal, // to make it mockable
): Promise<string> {
return new Promise((resolve, reject) => {
execFile("heif-convert", [filePath, targetPath], (error, stdout, stderr) => {