diff --git a/packages/dev-server/test/component-composition-runtime.test.ts b/packages/dev-server/test/component-composition-runtime.test.ts index 204012a1..bd53ce5d 100644 --- a/packages/dev-server/test/component-composition-runtime.test.ts +++ b/packages/dev-server/test/component-composition-runtime.test.ts @@ -3,6 +3,7 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"; import { basename, join } from "node:path"; import { tmpdir } from "node:os"; import { buildRouter } from "@wrnexus/router"; +import { resolveI18n } from "@wrnexus/i18n"; import { createHandlers, type RuntimeDeps } from "../src/runtime.ts"; const roots: string[] = []; @@ -45,3 +46,29 @@ test("a component nested in another component's slot keeps its boundary", async expect(html).toContain('x'); expect(html).not.toContain('data-component="Badge"'); }); + +test("translated text is present in the raw server response", async () => { + const root = mkdtempSync(join(tmpdir(), "wrnexus-ssr-i18n-")); + roots.push(root); + const app = join(root, "app"); + mkdirSync(join(app, "pages"), { recursive: true }); + writeFileSync(join(app, "pages/index.ts"), "export default () => '';\n"); + + const handlers = createHandlers({ + mode: "development", + hmr: false, + router: buildRouter(app), + i18n: resolveI18n({ en: { nav: { title: "Navigation" } } }, { default: "en" }), + loadModule: async () => ({ + default: () => '', + }), + getMiddleware: async () => [], + assets: { serve: async () => null }, + } satisfies RuntimeDeps); + + const response = await handlers.fetch(new Request("https://example.test/"), { + upgrade: () => false, + }); + const html = await response!.text(); + expect(html).toContain('Navigation'); +});