chore(icon_pack): map ttf

This commit is contained in:
Elian Doran 2025-12-26 17:31:35 +02:00
parent d121de5152
commit 98de4b6dc3
No known key found for this signature in database
2 changed files with 42 additions and 1 deletions

View File

@ -60,4 +60,44 @@ describe("Mapping attachments", () => {
const attachment = determineBestFontAttachment(iconPackNote); const attachment = determineBestFontAttachment(iconPackNote);
expect(attachment?.mime).toStrictEqual("font/woff"); expect(attachment?.mime).toStrictEqual("font/woff");
}); });
it("handles ttf", () => {
const iconPackNote = buildNote({
type: "text",
attachments: [
{
role: "file",
title: "Font",
mime: "font/ttf"
}
]
});
const attachment = determineBestFontAttachment(iconPackNote);
expect(attachment?.mime).toStrictEqual("font/ttf");
});
it("prefers woff2", () => {
const iconPackNote = buildNote({
type: "text",
attachments: [
{
role: "file",
title: "Font",
mime: "font/woff"
},
{
role: "file",
title: "Font",
mime: "font/ttf"
},
{
role: "file",
title: "Font",
mime: "font/woff2"
}
]
});
const attachment = determineBestFontAttachment(iconPackNote);
expect(attachment?.mime).toStrictEqual("font/woff2");
});
}); });

View File

@ -4,7 +4,8 @@ import log from "./log";
const PREFERRED_MIME_TYPE = [ const PREFERRED_MIME_TYPE = [
"font/woff2", "font/woff2",
"font/woff" "font/woff",
"font/ttf"
]; ];
export interface IconPackManifest { export interface IconPackManifest {