import { describe, expect, it } from "@suaveplan/testing/runner"; import { createFontConverter, FontConvertError } from "../src/index.js"; /** * Integration tests that require a real font binary. * Full real-font round-trip tests live in font-compress roundtrip.test.ts. */ describe("font-convert integration", () => { it("throws FontConvertError on obviously corrupt binary", { timeout: 5000, }, () => { const converter = createFontConverter(); const garbage = new Uint8Array(64).fill(0xff); expect(() => converter.convert(garbage)).toThrow(FontConvertError); }); it("createFontConverter returns converter with convert method", { timeout: 5000, }, () => { const converter = createFontConverter(); expect(typeof converter.convert).toBe("function"); expect(typeof converter.convertFromParsed).toBe("function"); }); it("FontConvertError preserves Error cause", { timeout: 5000 }, () => { const cause = new Error("root cause"); const err = new FontConvertError( "FONT_CONVERT.PARSE_FAILED" as any, "wrapped", { cause } ); expect(err.cause).toBe(cause); }); it("FontConvertError preserves context when provided", { timeout: 5000, }, () => { const err = new FontConvertError( "FONT_CONVERT.INVALID_OPTIONS" as any, "bad options", { context: { field: "value" } } ); expect(err.context).toEqual({ field: "value" }); }); });