18 lines
671 B
TypeScript
18 lines
671 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { imageContentDisposition } from "@/lib/guides/export-image";
|
|
|
|
describe("guide image downloads", () => {
|
|
it("provides a safe ASCII fallback and a UTF-8 filename", () => {
|
|
expect(imageContentDisposition("ไกด์อาวุธ", "weapons")).toBe(
|
|
"attachment; filename=\"weapons.png\"; filename*=UTF-8''%E0%B9%84%E0%B8%81%E0%B8%94%E0%B9%8C%E0%B8%AD%E0%B8%B2%E0%B8%A7%E0%B8%B8%E0%B8%98.png",
|
|
);
|
|
});
|
|
|
|
it("sanitizes punctuation in the fallback filename", () => {
|
|
expect(imageContentDisposition("Arlecchino / R5", "weapons")).toContain(
|
|
'filename="Arlecchino-R5.png"',
|
|
);
|
|
});
|
|
});
|