mirror of
https://github.com/C4illin/ConvertX.git
synced 2025-11-02 04:53:22 +00:00
test: extract duplicate code into another helper
This commit is contained in:
@@ -2,12 +2,7 @@ import type { ExecFileException } from "node:child_process";
|
||||
import { beforeEach, expect, test } from "bun:test";
|
||||
import { convert } from "../../src/converters/imagemagick.ts";
|
||||
import { ExecFileFn } from "../../src/converters/types.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 respects ico conversion target type", async () => {
|
||||
const originalConsoleLog = console.log;
|
||||
|
||||
Reference in New Issue
Block a user