test: add unit test for xelatex.ts
This commit is contained in:
parent
9f6b815197
commit
6452d0b357
2 changed files with 22 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { execFile } from "node:child_process";
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
import { ExecFileFn } from "./types.ts";
|
||||
|
||||
export const properties = {
|
||||
from: {
|
||||
|
|
@ -14,8 +15,8 @@ export function convert(
|
|||
fileType: string,
|
||||
convertTo: string,
|
||||
targetPath: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
options?: unknown,
|
||||
execFile: ExecFileFn = execFileOriginal,
|
||||
): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
// const fileName: string = (targetPath.split("/").pop() as string).replace(".pdf", "")
|
||||
|
|
|
|||
19
tests/converters/xelatex.test.ts
Normal file
19
tests/converters/xelatex.test.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { test } from "bun:test";
|
||||
import { convert } from "../../src/converters/xelatex.ts";
|
||||
import {
|
||||
runConvertFailTest,
|
||||
runConvertLogsStderror,
|
||||
runConvertSuccessTest,
|
||||
} from "./helpers/converters.ts";
|
||||
|
||||
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);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue