// @vitest-environment jsdom import { render, screen } from "@testing-library/react"; import { describe, expect, it, vi } from "vitest"; import { createRuntimeComposition } from "../../src/bootstrap/create-runtime-composition.ts"; import { RuntimeApplication } from "../../src/bootstrap/runtime-application.tsx"; const runtimeConfig = { APP_ENV: "local", API_BASE_URL: "http://localhost:8080", REQUEST_TIMEOUT_MS: 10_000, MAX_RETRY_ATTEMPTS: 2, TELEMETRY_ENABLED: false, AUTH_MODE: "demo", CONFIG_SCHEMA_VERSION: "1", API_CONTRACT_VERSION: "1", RELEASE_MANIFEST_URL: "/release-manifest.json", BUILD_ID: "local-build", RELEASE_ID: "local-release", }; const releaseManifest = { schemaVersion: 1, appVersion: "0.1.0", buildId: "local-build", commitSha: "local", configSchemaVersion: "1", apiContractVersion: "1", assetManifestHash: "test-hash", releaseId: "local-release", builtAt: "2026-07-26T00:00:00.000Z", routeChunks: { "route-tech-log-home": "assets/tech-log-home.js", "route-tech-log-explore": "assets/tech-log-explore.js", "route-tech-log-explore-kind": "assets/tech-log-explore-kind.js", "route-tech-log-case": "assets/tech-log-case.js", "route-tech-log-reference": "assets/tech-log-reference.js", "route-tech-log-question": "assets/tech-log-question.js", "route-tech-log-topic": "assets/tech-log-topic.js", "route-tech-log-projects": "assets/tech-log-projects.js", "route-tech-log-project": "assets/tech-log-project.js", "route-tech-log-project-records": "assets/tech-log-project-records.js", "route-tech-log-project-decisions": "assets/tech-log-project-decisions.js", "route-tech-log-project-activity": "assets/tech-log-project-activity.js", "route-tech-log-releases": "assets/tech-log-releases.js", "route-tech-log-release": "assets/tech-log-release.js", "route-tech-log-profile": "assets/tech-log-profile.js", "route-tech-log-search": "assets/tech-log-search.js", "route-tech-log-studio-home": "assets/tech-log-studio-home.js", "route-tech-log-studio-documents": "assets/tech-log-studio-documents.js", "route-tech-log-studio-document-new": "assets/tech-log-studio-document-new.js", "route-tech-log-studio-document-edit": "assets/tech-log-studio-document-edit.js", "route-tech-log-studio-document-validation": "assets/tech-log-studio-document-validation.js", "route-tech-log-studio-document-preview": "assets/tech-log-studio-document-preview.js", "route-tech-log-studio-document-publish": "assets/tech-log-studio-document-publish.js", "route-tech-log-studio-publications": "assets/tech-log-studio-publications.js", "route-tech-log-studio-publication-preview": "assets/tech-log-studio-publication-preview.js", "route-tech-log-studio-not-found": "assets/tech-log-studio-not-found.js", "route-not-found": "assets/not-found.js", }, }; describe("production runtime application tree", () => { it("connects validated config and release through composition and ApplicationProvider", async () => { const fetcher = vi.fn(async (input) => { const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url; return Response.json( url.includes("release-manifest") ? releaseManifest : runtimeConfig, ); }); const composition = await createRuntimeComposition({ fetcher, host: {}, }); window.history.pushState({}, "", "/"); render(); expect( await screen.findByRole("heading", { name: "TechLog", }), ).toBeVisible(); expect( await screen.findAllByText( "문제를 재현하고 검증해 운영 가능한 설계로 연결합니다.", ), ).toHaveLength(2); expect(fetcher).toHaveBeenCalledTimes(2); expect(composition).not.toHaveProperty("ports"); }); });