test: extract duplicate code into another helper

This commit is contained in:
Jörg Krzeslak 2025-07-24 21:08:10 +02:00
parent c6006b58d2
commit c0105889ab
13 changed files with 58 additions and 244 deletions

View file

@ -0,0 +1,26 @@
import { test } from "bun:test";
import { ConvertFnWithExecFile } from "../../../src/converters/types.ts";
import {
runConvertFailTest,
runConvertLogsStderror,
runConvertLogsStderrorAndStdout,
runConvertSuccessTest,
} from "./converters.ts";
export function runCommonTests(convert: ConvertFnWithExecFile) {
test("convert resolves when execFile succeeds", async () => {
await runConvertSuccessTest(convert);
});
test("convert rejects when execFile fails", async () => {
await runConvertFailTest(convert);
});
test("convert logs stderr when present", async () => {
await runConvertLogsStderror(convert);
});
test("convert logs both stderr and stdout when present", async () => {
await runConvertLogsStderrorAndStdout(convert);
});
}