mirror of
https://github.com/mgeeky/decode-spam-headers.git
synced 2026-02-22 13:33:30 +01:00
MAESTRO: improve standalone HTML export
This commit is contained in:
@@ -136,7 +136,7 @@ describe("ReportExport", () => {
|
||||
expect(createObjectUrlSpy).toHaveBeenCalled();
|
||||
expect(clickSpy).toHaveBeenCalled();
|
||||
expect(lastBlob).not.toBeNull();
|
||||
expect(lastBlob?.type).toBe("application/json");
|
||||
expect(lastBlob?.type).toBe("application/json;charset=utf-8");
|
||||
|
||||
const text = await lastBlob?.text();
|
||||
const parsed = JSON.parse(text ?? "{}") as AnalysisReport;
|
||||
@@ -144,7 +144,7 @@ describe("ReportExport", () => {
|
||||
expect(parsed.results[0]?.testId).toBe(101);
|
||||
});
|
||||
|
||||
it("triggers an HTML download", () => {
|
||||
it("triggers an HTML download with styled markup", async () => {
|
||||
const { container } = render(<ReportExport report={report} />);
|
||||
|
||||
const htmlButton = getByTestId(container, "report-export-html");
|
||||
@@ -155,5 +155,13 @@ describe("ReportExport", () => {
|
||||
|
||||
expect(createObjectUrlSpy).toHaveBeenCalled();
|
||||
expect(clickSpy).toHaveBeenCalled();
|
||||
expect(lastBlob?.type).toBe("text/html;charset=utf-8");
|
||||
|
||||
const text = await lastBlob?.text();
|
||||
expect(text).toContain("<!doctype html>");
|
||||
expect(text).toContain("<style>");
|
||||
expect(text).toContain("Email Header Analysis Report");
|
||||
expect(text).toContain("Summary");
|
||||
expect(text).toContain("SpamAssassin Rule Hits");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user