@@ -23,15 +23,33 @@ describe("UploadWorkbench", () => {
|
||||
const user = userEvent.setup();
|
||||
render(<UploadWorkbench />);
|
||||
const input = screen.getByLabelText("Open office file");
|
||||
const file = new File(["local fixture"], "report.docx", {
|
||||
const bytes = new Uint8Array(13);
|
||||
bytes.set([0x50, 0x4b, 0x03, 0x04]);
|
||||
const file = new File([bytes], "report.docx", {
|
||||
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||
});
|
||||
|
||||
await user.upload(input, file);
|
||||
|
||||
const heading = screen.getByRole("region", { name: "report.docx" });
|
||||
const heading = await screen.findByRole("region", { name: "report.docx" });
|
||||
expect(heading).toHaveTextContent("report.docx");
|
||||
expect(heading).toHaveTextContent("13 B");
|
||||
expect(screen.getByLabelText("Test OOXML viewer")).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("button", { name: "Save exact copy" }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
it("explains a renamed legacy compound-binary file", async () => {
|
||||
const user = userEvent.setup();
|
||||
render(<UploadWorkbench />);
|
||||
const file = new File(
|
||||
[Uint8Array.from([0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1])],
|
||||
"renamed.docx",
|
||||
);
|
||||
await user.upload(screen.getByLabelText("Open office file"), file);
|
||||
expect(await screen.findByRole("alert")).toHaveTextContent(
|
||||
"legacy OLE Compound File",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user