test: add parameter options to usage of type ExecFileFn
This commit is contained in:
parent
c0f0dc5192
commit
08a833f1cf
22 changed files with 71 additions and 41 deletions
|
|
@ -37,6 +37,7 @@ test("convert respects eps filetype", async () => {
|
|||
const mockExecFile: ExecFileFn = (
|
||||
_cmd: string,
|
||||
_args: string[],
|
||||
options: unknown,
|
||||
callback: (err: ExecFileException | null, stdout: string, stderr: string) => void,
|
||||
) => {
|
||||
calls.push(_args);
|
||||
|
|
@ -63,6 +64,7 @@ test("convert respects pdf filetype", async () => {
|
|||
const mockExecFile: ExecFileFn = (
|
||||
_cmd: string,
|
||||
_args: string[],
|
||||
options: unknown,
|
||||
callback: (err: ExecFileException | null, stdout: string, stderr: string) => void,
|
||||
) => {
|
||||
calls.push(_args);
|
||||
|
|
@ -89,6 +91,7 @@ test("convert respects svgz conversion target type", async () => {
|
|||
const mockExecFile: ExecFileFn = (
|
||||
_cmd: string,
|
||||
_args: string[],
|
||||
options: unknown,
|
||||
callback: (err: ExecFileException | null, stdout: string, stderr: string) => void,
|
||||
) => {
|
||||
calls.push(_args);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ let calls: string[][] = [];
|
|||
function mockExecFile(
|
||||
_cmd: string,
|
||||
args: string[],
|
||||
options: unknown,
|
||||
callback: (err: Error | null, stdout: string, stderr: string) => void,
|
||||
) {
|
||||
calls.push(args);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ export async function runConvertSuccessTest(convertFn: ConvertFnWithExecFile) {
|
|||
const mockExecFile: ExecFileFn = (
|
||||
_cmd: string,
|
||||
_args: string[],
|
||||
options: unknown,
|
||||
callback: (err: ExecFileException | null, stdout: string, stderr: string) => void,
|
||||
) => {
|
||||
callback(null, "Fake stdout", "");
|
||||
|
|
@ -30,6 +31,7 @@ export async function runConvertFailTest(convertFn: ConvertFnWithExecFile) {
|
|||
const mockExecFile: ExecFileFn = (
|
||||
_cmd: string,
|
||||
_args: string[],
|
||||
options: unknown,
|
||||
callback: (err: ExecFileException | null, stdout: string, stderr: string) => void,
|
||||
) => {
|
||||
callback(new Error("Test error"), "", "");
|
||||
|
|
@ -51,9 +53,10 @@ export async function runConvertLogsStderror(convertFn: ConvertFnWithExecFile) {
|
|||
const mockExecFile = (
|
||||
_cmd: string,
|
||||
_args: string[],
|
||||
cb: (err: Error | null, stdout: string, stderr: string) => void,
|
||||
options: unknown,
|
||||
callback: (err: Error | null, stdout: string, stderr: string) => void,
|
||||
) => {
|
||||
cb(null, "", "Fake stderr");
|
||||
callback(null, "", "Fake stderr");
|
||||
};
|
||||
|
||||
await convertFn("file.obj", "obj", "stl", "out.stl", undefined, mockExecFile);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ test("convert respects ico conversion target type", async () => {
|
|||
const mockExecFile: ExecFileFn = (
|
||||
_cmd: string,
|
||||
_args: string[],
|
||||
options: unknown,
|
||||
callback: (err: ExecFileException | null, stdout: string, stderr: string) => void,
|
||||
) => {
|
||||
calls.push(_args);
|
||||
|
|
@ -72,6 +73,7 @@ test("convert respects ico conversion target type with svg as input filetype", a
|
|||
const mockExecFile: ExecFileFn = (
|
||||
_cmd: string,
|
||||
_args: string[],
|
||||
options: unknown,
|
||||
callback: (err: ExecFileException | null, stdout: string, stderr: string) => void,
|
||||
) => {
|
||||
calls.push(_args);
|
||||
|
|
@ -109,6 +111,7 @@ test("convert respects ico conversion target type with emf as input filetype", a
|
|||
const mockExecFile: ExecFileFn = (
|
||||
_cmd: string,
|
||||
_args: string[],
|
||||
options: unknown,
|
||||
callback: (err: ExecFileException | null, stdout: string, stderr: string) => void,
|
||||
) => {
|
||||
calls.push(_args);
|
||||
|
|
@ -150,6 +153,7 @@ test("convert respects emf as input filetype", async () => {
|
|||
const mockExecFile: ExecFileFn = (
|
||||
_cmd: string,
|
||||
_args: string[],
|
||||
options: unknown,
|
||||
callback: (err: ExecFileException | null, stdout: string, stderr: string) => void,
|
||||
) => {
|
||||
calls.push(_args);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ test("convert uses djxl with input filetype being jxl", async () => {
|
|||
const mockExecFile: ExecFileFn = (
|
||||
_cmd: string,
|
||||
_args: string[],
|
||||
options: unknown,
|
||||
callback: (err: ExecFileException | null, stdout: string, stderr: string) => void,
|
||||
) => {
|
||||
command = _cmd;
|
||||
|
|
@ -63,6 +64,7 @@ test("convert uses cjxl with output filetype being jxl", async () => {
|
|||
const mockExecFile: ExecFileFn = (
|
||||
_cmd: string,
|
||||
_args: string[],
|
||||
options: unknown,
|
||||
callback: (err: ExecFileException | null, stdout: string, stderr: string) => void,
|
||||
) => {
|
||||
command = _cmd;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ test("convert uses action pdfload with filetype being pdf", async () => {
|
|||
const mockExecFile: ExecFileFn = (
|
||||
_cmd: string,
|
||||
_args: string[],
|
||||
options: unknown,
|
||||
callback: (err: ExecFileException | null, stdout: string, stderr: string) => void,
|
||||
) => {
|
||||
calls.push(_args);
|
||||
|
|
@ -63,6 +64,7 @@ test("convert uses action copy with filetype being anything but pdf", async () =
|
|||
const mockExecFile: ExecFileFn = (
|
||||
_cmd: string,
|
||||
_args: string[],
|
||||
options: unknown,
|
||||
callback: (err: ExecFileException | null, stdout: string, stderr: string) => void,
|
||||
) => {
|
||||
calls.push(_args);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue