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
|
|
@ -2,12 +2,7 @@ import type { ExecFileException } from "node:child_process";
|
|||
import { beforeEach, expect, test } from "bun:test";
|
||||
import { ExecFileFn } from "../../src/converters/types.ts";
|
||||
import { convert } from "../../src/converters/vips.ts";
|
||||
import {
|
||||
runConvertFailTest,
|
||||
runConvertLogsStderror,
|
||||
runConvertLogsStderrorAndStdout,
|
||||
runConvertSuccessTest,
|
||||
} from "./helpers/converters.ts";
|
||||
import { runCommonTests } from "./helpers/commonTests.ts";
|
||||
|
||||
let calls: string[][] = [];
|
||||
|
||||
|
|
@ -15,21 +10,7 @@ beforeEach(() => {
|
|||
calls = [];
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
runCommonTests(convert);
|
||||
|
||||
test("convert uses action pdfload with filetype being pdf", async () => {
|
||||
const originalConsoleLog = console.log;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue