Fix to Fix error in previous fix, and adapt tests
This commit is contained in:
parent
22cdf40d6e
commit
e6f8bea804
2 changed files with 5 additions and 4 deletions
|
|
@ -124,7 +124,9 @@ const filters: Record<FileCategories, Record<string, string>> = {
|
|||
};
|
||||
|
||||
const getFilters = (fileType: string, converto: string) => {
|
||||
if (fileType in filters.text && converto in filters.text) {
|
||||
if (converto === "pdf") {
|
||||
return [null, null];
|
||||
} else if (fileType in filters.text && converto in filters.text) {
|
||||
return [filters.text[fileType], filters.text[converto]];
|
||||
} else if (fileType in filters.calc && converto in filters.calc) {
|
||||
return [filters.calc[fileType], filters.calc[converto]];
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ test("invokes soffice with --headless and outdir derived from targetPath", async
|
|||
expect(cmd).toBe("soffice");
|
||||
expect(args).toEqual([
|
||||
"--headless",
|
||||
`--infilter="MS Word 2007 XML"`,
|
||||
`--infilter=MS Word 2007 XML`,
|
||||
"--convert-to",
|
||||
"odt:writer8",
|
||||
"--outdir",
|
||||
|
|
@ -77,8 +77,7 @@ test("uses only outFilter when input has no filter (e.g., pdf -> txt)", async ()
|
|||
|
||||
const { args } = requireDefined(calls[0], "Expected at least one execFile call");
|
||||
|
||||
expect(args).not.toContainEqual(expect.stringMatching(/^--infilter=/));
|
||||
expect(args).toEqual(["--headless", "--convert-to", "txt", "--outdir", "out", "in.pdf"]);
|
||||
expect(args).toEqual(["--headless", "--infilter=writer_pdf_import","--convert-to", "txt:Text", "--outdir", "out", "in.pdf"]);
|
||||
});
|
||||
|
||||
test("uses only infilter when convertTo has no out filter (e.g., docx -> pdf)", async () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue