diff --git a/frontend/editor/src/core/utils/fileUtils.test.ts b/frontend/editor/src/core/utils/fileUtils.test.ts index 8b1a1afd9..fcdb53926 100644 --- a/frontend/editor/src/core/utils/fileUtils.test.ts +++ b/frontend/editor/src/core/utils/fileUtils.test.ts @@ -3,6 +3,7 @@ import { isPdfFile, detectFileExtension, formatFileSize, + detectNonPdfFileType, } from "@app/utils/fileUtils"; describe("fileUtils", () => { @@ -94,4 +95,18 @@ describe("fileUtils", () => { expect(formatFileSize(1024 * 1024 * 1024)).toBe("1 GB"); }); }); + + describe("detectNonPdfFileType", () => { + it("should prioritize MIME type over extension when they conflict", () => { + expect( + detectNonPdfFileType({ + name: "financial-summary.pdf", + type: "text/csv", + }), + ).toBe("csv"); + expect( + detectNonPdfFileType({ name: "diagram.png", type: "application/json" }), + ).toBe("json"); + }); + }); });