// @vitest-environment jsdom import { render, screen, within } from "@testing-library/react"; import { Suspense } from "react"; import { describe, expect, it, vi } from "vitest"; import { ROUTE_REGISTRY } from "../../src/features/installed-feature-contracts.ts"; import { LocaleProvider } from "../../src/presentation/i18n/index.ts"; import { ApplicationProvider } from "../../src/presentation/providers/application-provider.tsx"; import { PLATFORM_ROUTE_RUNTIME } from "../../src/presentation/routes/route-runtime.tsx"; import { createTestApplication } from "../helpers/create-test-application.ts"; // The feature runtimes never arrive: the route must not wait for them. vi.mock("../../src/features/installed-feature-runtime-registries.ts", () => ({ loadInstalledFeatureRuntimeRegistries: () => new Promise(() => {}), })); /** * 1103/15-01. The lab gate (FE-GATE-026) times this route from the click to * its heading. Its route module used to await every installed feature's * runtime half first, which added a second request round to the click. */ describe("platform overview route module", () => { it("draws the title and the declared routes before the feature runtimes load", async () => { const Page = PLATFORM_ROUTE_RUNTIME.EXAMPLES_PLATFORM.Component; render( route chunk

}>
, ); expect( await screen.findByRole("heading", { level: 1, name: "플랫폼 구성" }), ).toBeVisible(); const routes = screen.getByRole("table", { name: "설치된 라우트 목록" }); expect(within(routes).getAllByRole("row").slice(1)).toHaveLength( Object.keys(ROUTE_REGISTRY).length, ); // Only the part read from the runtime halves waits. const contracts = screen.getByRole("region", { name: "계약과 HTTP 오퍼레이션", }); expect( within(contracts).getByLabelText("기능 실행부를 불러오고 있습니다."), ).toBeVisible(); expect( screen.queryByRole("table", { name: "설치된 HTTP 오퍼레이션" }), ).toBeNull(); }); });