test: extract duplicate code into another helper
This commit is contained in:
parent
c6006b58d2
commit
c0105889ab
13 changed files with 58 additions and 244 deletions
26
tests/converters/helpers/commonTests.ts
Normal file
26
tests/converters/helpers/commonTests.ts
Normal 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);
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue