diff --git a/packages/cli/src/utils/bundleWithLocalizedFonts.test.ts b/packages/cli/src/utils/bundleWithLocalizedFonts.test.ts index fb7e7a751..1d9300b40 100644 --- a/packages/cli/src/utils/bundleWithLocalizedFonts.test.ts +++ b/packages/cli/src/utils/bundleWithLocalizedFonts.test.ts @@ -1,9 +1,19 @@ import { afterEach, describe, expect, it, vi } from "vitest"; +const producerMocks = vi.hoisted(() => ({ + loadProducer: vi.fn(async () => ({ + injectDeterministicFontFaces: async (html: string) => `${html}`, + })), +})); + vi.mock("@hyperframes/core/compiler", () => ({ bundleToSingleHtml: vi.fn(async () => "
bundled"), })); +vi.mock("./producer.js", () => ({ + loadProducer: producerMocks.loadProducer, +})); + import { __resetFontLocalizationWarningsForTests, bundleWithLocalizedFonts, @@ -31,6 +41,12 @@ describe("bundleWithLocalizedFonts (call-site integration)", () => { }); describe("localizeWithProducer", () => { + it("loads the injector through the producer module bundled with the CLI", async () => { + const out = await localizeWithProducer(""); + expect(producerMocks.loadProducer).toHaveBeenCalledOnce(); + expect(out).toBe(""); + }); + it("embeds fonts when the injector is available", async () => { const inject = vi.fn(async (html: string) => `${html}`); const warn = vi.fn(); diff --git a/packages/cli/src/utils/bundleWithLocalizedFonts.ts b/packages/cli/src/utils/bundleWithLocalizedFonts.ts index 46dd6a8cf..1e71e1119 100644 --- a/packages/cli/src/utils/bundleWithLocalizedFonts.ts +++ b/packages/cli/src/utils/bundleWithLocalizedFonts.ts @@ -29,14 +29,11 @@ export async function bundleWithLocalizedFonts( type FontInjector = (html: string) => Promise