Open History to see the last commit
1import { describe, expect, it } from "vite-plus/test";
2
3import { isPdfFile } from "./filePreview";
4
5describe("PDF preview detection", () => {
6 it.each([
7 [{ name: "download", mimeType: "APPLICATION/PDF; charset=binary" }, true],
8 [{ name: "https://example.com/report.pdf?signature=abc#page=2" }, true],
9 [{ name: "report.pdf", mimeType: "text/plain" }, false],
10 [{ name: "https://example.com/page?download=report.pdf" }, false],
11 ])("classifies %j as %s", (file, expected) => {
12 expect(isPdfFile(file)).toBe(expected);
13 });
14});