fix: 簡化 MinerU 和 PDFMathTranslate 的程式碼,改善錯誤處理與參數傳遞

This commit is contained in:
Your Name 2026-01-22 22:27:40 +08:00
parent 566ee48bfe
commit 89c121bdf9
4 changed files with 36 additions and 26 deletions

View file

@ -203,9 +203,9 @@ describe("MinerU converter .tar output (no compression)", () => {
};
const targetPath = join(testDir, "output.tar");
expect(convert("test.pdf", "pdf", "md-t", targetPath, undefined, mockExecFile)).rejects.toMatch(
/mineru error/,
);
await expect(
convert("test.pdf", "pdf", "md-t", targetPath, undefined, mockExecFile),
).rejects.toThrow(/mineru error/);
});
test("should use correct tar arguments without compression", async () => {

View file

@ -85,7 +85,7 @@ describe("PDFMathTranslate converter - Chinese translation", () => {
expect(pdf2zhCalled).toBe(true);
expect(pdf2zhArgs).toContain("-lo");
expect(pdf2zhArgs).toContain("zh");
expect(pdf2zhArgs).toContain("zh-CN"); // zh is normalized to zh-CN
expect(pdf2zhArgs).toContain("-o");
expect(pdf2zhArgs).toContain("-s"); // Translation service
});