diff --git a/docs/architecture/starter-experience.md b/docs/architecture/starter-experience.md
index f2aee656..33d0c8fb 100644
--- a/docs/architecture/starter-experience.md
+++ b/docs/architecture/starter-experience.md
@@ -83,6 +83,17 @@ and the
[TypeScript, state, and data-flow target](./typescript-state-and-data-flow.md)
rather than adding another independent route or data-loading convention.
+### Replacing the starter screens
+
+`/` (`src/presentation/pages/home-page.tsx`) and `/examples/*`
+(`src/presentation/examples/`) are template content. Their own tests are the
+`tests/component/starter-*.test.tsx` files; delete them together with the
+screens. The platform's component tests (router, boundaries, shell, runtime
+tree) run on the pages of the test-only feature in
+`tests/helpers/fixture-feature.tsx` and keep passing when the starter screens
+change. Browser-level checks of the starter screens stay in `tests/e2e` and
+`tests/visual`.
+
### Ownership declarations
Features, contexts and apps are discovered by
diff --git a/tests/component/app-shell.test.tsx b/tests/component/app-shell.test.tsx
index b43a61d3..81d026a7 100644
--- a/tests/component/app-shell.test.tsx
+++ b/tests/component/app-shell.test.tsx
@@ -2,13 +2,23 @@
import { render, screen, waitFor, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-import { afterEach, beforeEach, describe, expect, it } from "vitest";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { ApplicationProvider } from "../../src/presentation/providers/application-provider.tsx";
import { PreferenceProviders } from "../../src/presentation/providers/preference-providers.tsx";
import { AppRouter } from "../../src/presentation/routes/app-router.tsx";
import { createTestApplication } from "../helpers/create-test-application.ts";
+// The drawer links to a test-only page, not a starter screen a product
+// replaces (0929/10-02).
+vi.mock("../../src/.generated/product-feature-index.ts", async () => ({
+ DECLARED_PRODUCT_FEATURE_IDS: ["fixture-feature"],
+ PRODUCT_FEATURE_MODULES: [(await import("../helpers/fixture-feature.tsx")).FIXTURE_FEATURE_MODULE],
+}));
+vi.mock("../../src/.generated/product-context-index.ts", async () => ({
+ PRODUCT_CONTEXT_MODULES: [(await import("../helpers/fixture-feature.tsx")).FIXTURE_CONTEXT_MODULE],
+}));
+
/**
* jsdom has no showModal/close and no modal inertness. Browsers ignore
* focus() outside an open modal dialog, which is what made the route focus
@@ -85,11 +95,13 @@ describe("app shell mobile navigation drawer", () => {
const menuButton = await screen.findByRole("button", { name: "메뉴" });
await user.click(menuButton);
const drawer = screen.getByRole("dialog", { name: "메뉴" });
- await user.click(within(drawer).getByRole("link", { name: "UI 구성요소" }));
+ await user.click(
+ within(drawer).getByRole("link", { name: "Fixture first page" }),
+ );
const heading = await screen.findByRole(
"heading",
- { name: "UI 구성요소", level: 1 },
+ { name: "Fixture first page", level: 1 },
);
await waitFor(() => expect(heading).toHaveFocus());
expect(menuButton).toHaveAttribute("aria-expanded", "false");
diff --git a/tests/component/async-surface.test.tsx b/tests/component/async-surface.test.tsx
index 56d3ceff..d13434b5 100644
--- a/tests/component/async-surface.test.tsx
+++ b/tests/component/async-surface.test.tsx
@@ -14,7 +14,6 @@ import {
LoadingSurface,
TerminalErrorSurface,
} from "../../src/presentation/design-system/index.ts";
-import StateGalleryPage from "../../src/presentation/examples/state-gallery-page.tsx";
describe("async UI state matrix", () => {
it.each([
@@ -364,18 +363,4 @@ describe("state surface titles (08-05)", () => {
expect(screen.queryAllByRole("heading", { level: 2 })).toHaveLength(0);
expect(screen.getAllByRole("heading", { level: 4 })).toHaveLength(1);
});
-
- it("nests the gallery's state titles under the card and section around them", () => {
- render();
-
- expect(
- screen.getByRole("heading", { name: "아직 표시할 항목이 없습니다.", level: 4 }),
- ).toBeVisible();
- expect(screen.getAllByRole("heading", { level: 3 }).map((h) => h.textContent))
- .toEqual(expect.arrayContaining(["빈 화면", "복구 가능한 오류"]));
- // Access states sit directly under the section's h2.
- expect(
- screen.queryAllByRole("heading", { level: 2 }).map((h) => h.textContent),
- ).toEqual(["비동기 데이터 상태", "접근과 탐색 상태"]);
- });
});
diff --git a/tests/component/chunk-recovery-boundary.test.tsx b/tests/component/chunk-recovery-boundary.test.tsx
index 1f9fe904..8ecd5c38 100644
--- a/tests/component/chunk-recovery-boundary.test.tsx
+++ b/tests/component/chunk-recovery-boundary.test.tsx
@@ -15,14 +15,15 @@ import { PreferenceProviders } from "../../src/presentation/providers/preference
import { AppRouter } from "../../src/presentation/routes/app-router.tsx";
import { createTestApplication } from "../helpers/create-test-application.ts";
-// The states page stands in for a route chunk the network could not deliver:
-// a rejected lazy module throws its rejection on every render, as this does.
-vi.mock("../../src/presentation/examples/state-gallery-page.tsx", () => ({
- default: function UnreachableChunk(): never {
- throw new TypeError(
- "Failed to fetch dynamically imported module: /assets/states.js",
- );
- },
+// The test-only feature's offline page stands in for a route chunk the network
+// could not deliver; the starter screens are the product's to replace
+// (0929/10-02).
+vi.mock("../../src/.generated/product-feature-index.ts", async () => ({
+ DECLARED_PRODUCT_FEATURE_IDS: ["fixture-feature"],
+ PRODUCT_FEATURE_MODULES: [(await import("../helpers/fixture-feature.tsx")).FIXTURE_FEATURE_MODULE],
+}));
+vi.mock("../../src/.generated/product-context-index.ts", async () => ({
+ PRODUCT_CONTEXT_MODULES: [(await import("../helpers/fixture-feature.tsx")).FIXTURE_CONTEXT_MODULE],
}));
function ChunkDefect(): never {
@@ -145,7 +146,7 @@ describe("chunk recovery boundary classification", () => {
// diagnostic also records.
it("shows an unrecovered chunk failure's support reference and records it", async () => {
const record = vi.fn();
- window.history.pushState({}, "", "/examples/states");
+ window.history.pushState({}, "", "/fixture/offline");
render(
{
level: "error",
eventId: "ui.render.failed",
context: expect.objectContaining({
- route_id: "EXAMPLES_STATES",
+ route_id: "FIXTURE_OFFLINE_PAGE",
build_id: "build-a",
correlation_id: incidentId,
}),
@@ -174,7 +175,7 @@ describe("chunk recovery boundary classification", () => {
// so a failure latched in one route's boundary would otherwise follow the
// user to every other page until a full reload.
const user = userEvent.setup();
- window.history.pushState({}, "", "/examples/states");
+ window.history.pushState({}, "", "/fixture/offline");
render(
@@ -189,12 +190,12 @@ describe("chunk recovery boundary classification", () => {
}),
).toBeVisible();
- await user.click(screen.getAllByRole("link", { name: "UI 구성요소" })[0]!);
+ await user.click(screen.getAllByRole("link", { name: "Fixture first page" })[0]!);
expect(
await screen.findByRole(
"heading",
- { name: "UI 구성요소", level: 1 },
+ { name: "Fixture first page", level: 1 },
),
).toBeVisible();
expect(
diff --git a/tests/component/render-boundary.test.tsx b/tests/component/render-boundary.test.tsx
index 4de85108..af04be2e 100644
--- a/tests/component/render-boundary.test.tsx
+++ b/tests/component/render-boundary.test.tsx
@@ -16,11 +16,15 @@ import { PreferenceProviders } from "../../src/presentation/providers/preference
import { AppRouter } from "../../src/presentation/routes/app-router.tsx";
import { createTestApplication } from "../helpers/create-test-application.ts";
-// The states page stands in for any route page with a programmer defect.
-vi.mock("../../src/presentation/examples/state-gallery-page.tsx", () => ({
- default: function BrokenPage(): never {
- throw new Error("ordinary render defect");
- },
+// The test-only feature's broken page stands in for any route page with a
+// programmer defect; the starter screens are the product's to replace
+// (0929/10-02).
+vi.mock("../../src/.generated/product-feature-index.ts", async () => ({
+ DECLARED_PRODUCT_FEATURE_IDS: ["fixture-feature"],
+ PRODUCT_FEATURE_MODULES: [(await import("../helpers/fixture-feature.tsx")).FIXTURE_FEATURE_MODULE],
+}));
+vi.mock("../../src/.generated/product-context-index.ts", async () => ({
+ PRODUCT_CONTEXT_MODULES: [(await import("../helpers/fixture-feature.tsx")).FIXTURE_CONTEXT_MODULE],
}));
function Defect(): ReactNode {
@@ -55,7 +59,7 @@ describe("render recovery boundaries", () => {
// same id the render diagnostic records, and a way out besides the URL.
it("shows a route render failure's support reference and records it", async () => {
const record = vi.fn();
- window.history.pushState({}, "", "/examples/states");
+ window.history.pushState({}, "", "/fixture/broken");
render(
{
level: "error",
eventId: "ui.render.failed",
context: expect.objectContaining({
- route_id: "EXAMPLES_STATES",
+ route_id: "FIXTURE_BROKEN_PAGE",
build_id: "build-a",
correlation_id: incidentId,
}),
diff --git a/tests/component/route-status-surfaces.test.tsx b/tests/component/route-status-surfaces.test.tsx
index ffef8894..ef5108a1 100644
--- a/tests/component/route-status-surfaces.test.tsx
+++ b/tests/component/route-status-surfaces.test.tsx
@@ -2,22 +2,18 @@
import { render, screen, waitFor, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-import { MemoryRouter } from "react-router-dom";
import { describe, expect, it, vi } from "vitest";
import { createAnonymousSessionAdapter } from "../../src/adapters/auth/external-session-adapter.ts";
import type { ApplicationOutputPorts } from "../../src/application/create-application.ts";
-import HomePage from "../../src/presentation/pages/home-page.tsx";
-import { PlatformOverviewPage } from "../../src/presentation/examples/platform-overview-page.tsx";
-import { COMPOSED_CONTRACT_CONTRIBUTIONS } from "../../src/features/loaded-feature-runtimes.ts";
-import { LocaleProvider } from "../../src/presentation/i18n/index.ts";
import { ApplicationProvider } from "../../src/presentation/providers/application-provider.tsx";
import { PreferenceProviders } from "../../src/presentation/providers/preference-providers.tsx";
import { AppRouter } from "../../src/presentation/routes/app-router.tsx";
import { createTestApplication } from "../helpers/create-test-application.ts";
-// Feature-route surfaces run against a test-only feature, not the removable
-// sample (FE-GATE-020 runs the suite after deleting the sample).
+// Routes and pages come from a test-only feature, not the removable sample
+// (FE-GATE-020 runs the suite after deleting the sample) nor the starter
+// screens a product replaces (0929/10-02; starter-*.test.tsx test those).
vi.mock("../../src/.generated/product-feature-index.ts", async () => ({
DECLARED_PRODUCT_FEATURE_IDS: ["fixture-feature"],
PRODUCT_FEATURE_MODULES: [(await import("../helpers/fixture-feature.tsx")).FIXTURE_FEATURE_MODULE],
@@ -54,17 +50,26 @@ function sessionWithSignIn(beginSignIn: (returnTo?: string) => Promise) {
}
describe("route-level status surfaces", () => {
- // First in the file: the home chunk has not been loaded yet, so the route
- // suspends and shows its loading surface.
+ // First in the file: the page chunk has not been loaded yet, so the route
+ // suspends and shows its own loading surface (the context's routes load
+ // behind a surface without the route's name).
it("shows the busy route loading surface while a page chunk loads", async () => {
- renderApp("/");
+ const { container } = renderApp("/fixture/first");
- const copy = screen.getByText("화면을 준비하고 있습니다.");
+ await waitFor(() =>
+ expect(
+ container.querySelector('.route-loading[data-surface="fixture-page"]'),
+ ).not.toBeNull(),
+ );
+ const surface = container.querySelector(
+ '.route-loading[data-surface="fixture-page"]',
+ )!;
+ const copy = within(surface).getByText("화면을 준비하고 있습니다.");
expect(copy.closest('[aria-busy="true"]')).not.toBeNull();
expect(
await screen.findByRole(
"heading",
- { name: "Clean Architecture Frontend", level: 1 },
+ { name: "Fixture first page", level: 1 },
),
).toBeVisible();
});
@@ -104,13 +109,13 @@ describe("route-level status surfaces", () => {
const user = userEvent.setup();
const pending = deferred();
const beginSignIn = vi.fn(() => pending.promise);
- renderApp("/examples/ui#buttons", { session: sessionWithSignIn(beginSignIn) });
+ renderApp("/fixture/first#buttons", { session: sessionWithSignIn(beginSignIn) });
const banner = screen.getByRole("banner");
await user.click(
await within(banner).findByRole("button", { name: "로그인" }),
);
- expect(beginSignIn).toHaveBeenCalledWith("/examples/ui#buttons");
+ expect(beginSignIn).toHaveBeenCalledWith("/fixture/first#buttons");
expect(within(banner).getByRole("button", { name: "처리 중…" })).toBeDisabled();
pending.reject(new Error("identity provider unavailable"));
@@ -119,22 +124,6 @@ describe("route-level status surfaces", () => {
);
});
- it("returns to the current URL with its hash from the auth example page", async () => {
- const user = userEvent.setup();
- const beginSignIn = vi.fn(async () => {});
- renderApp("/examples/auth#session", {
- session: sessionWithSignIn(beginSignIn),
- });
-
- await user.click(
- await screen.findByRole(
- "button",
- { name: "로그인 시작" },
- ),
- );
- expect(beginSignIn).toHaveBeenCalledWith("/examples/auth#session");
- });
-
it("answers an unknown address with a home link that keeps the basename", async () => {
renderApp("/app/missing", {}, "/app");
@@ -149,64 +138,3 @@ describe("route-level status surfaces", () => {
).toHaveAttribute("href", "/app");
});
});
-
-describe("temporary release loaders", () => {
- function failingReleaseApplication() {
- return createTestApplication({
- releaseInfo: {
- getCurrent: async () => {
- throw new Error("manifest unavailable");
- },
- refresh: async () => {
- throw new Error("manifest unavailable");
- },
- },
- });
- }
-
- it("stops the home page release summary from loading forever", async () => {
- window.history.pushState({}, "", "/");
- render(
-
-
-
-
- ,
- );
- await waitFor(() =>
- expect(
- screen.getByText("런타임 정보를 확인하지 못했습니다."),
- ).toBeVisible(),
- );
- expect(
- screen.queryByText("검증된 런타임 정보를 확인하고 있습니다."),
- ).not.toBeInTheDocument();
- });
-
- it("stops the platform overview release metrics from loading forever", async () => {
- render(
-
-
-
-
- ,
- );
- await waitFor(() =>
- expect(
- screen.getByText("런타임 정보를 확인하지 못했습니다."),
- ).toBeVisible(),
- );
- expect(
- screen.queryByText("런타임 정보를 확인하고 있습니다."),
- ).not.toBeInTheDocument();
- });
-});
-
-/** HomePage renders router links, so it needs a router but not the app one. */
-function AppRouterlessHome() {
- return (
-
-
-
- );
-}
diff --git a/tests/component/router.test.tsx b/tests/component/router.test.tsx
index 03cb000d..204ed714 100644
--- a/tests/component/router.test.tsx
+++ b/tests/component/router.test.tsx
@@ -16,8 +16,9 @@ import { AppRouter } from "../../src/presentation/routes/app-router.tsx";
import { createTestApplication } from "../helpers/create-test-application.ts";
import { createProductFeaturesStub } from "../helpers/runtime-capabilities-stub.ts";
-// Feature-route surfaces run against a test-only feature, not the removable
-// sample (FE-GATE-020 runs this file after deleting the sample).
+// Routes and pages come from a test-only feature, not the removable sample
+// (FE-GATE-020 runs this file after deleting the sample) nor the starter
+// screens a product replaces (0929/10-02; starter-*.test.tsx test those).
vi.mock("../../src/.generated/product-feature-index.ts", async () => ({
DECLARED_PRODUCT_FEATURE_IDS: ["fixture-feature"],
PRODUCT_FEATURE_MODULES: [(await import("../helpers/fixture-feature.tsx")).FIXTURE_FEATURE_MODULE],
@@ -61,22 +62,6 @@ function routeChangeReports(record: ReturnType) {
}
describe("generic application router", () => {
- it("reaches the platform overview from the home starter actions", async () => {
- const user = userEvent.setup();
- window.history.pushState({}, "", "/");
- renderRouter();
-
- await user.click(
- await screen.findByRole("link", { name: "플랫폼 구성 보기" }),
- );
-
- await waitFor(() =>
- expect(
- screen.getByRole("heading", { name: "플랫폼 구성", level: 1 }),
- ).toHaveFocus(),
- );
- });
-
it("renders the app shell and not-found route without a feature input", async () => {
window.history.pushState({}, "", "/missing");
renderRouter();
@@ -90,25 +75,25 @@ describe("generic application router", () => {
expect(screen.getByRole("main")).toBeVisible();
});
- it("navigates between registry-backed platform routes", async () => {
+ it("navigates between registry-backed routes", async () => {
const user = userEvent.setup();
window.history.pushState({}, "", "/");
renderRouter();
await user.click(
- await screen.findByRole("link", { name: "UI 구성요소" }),
+ await screen.findByRole("link", { name: "Fixture first page" }),
);
expect(
- await screen.findByRole("heading", { name: "UI 구성요소", level: 1 }),
+ await screen.findByRole("heading", { name: "Fixture first page", level: 1 }),
).toBeVisible();
- expect(window.location.pathname).toBe("/examples/ui");
+ expect(window.location.pathname).toBe("/fixture/first");
await waitFor(() =>
- expect(document.title).toBe("UI 구성요소 · Frontend Skeleton"),
+ expect(document.title).toBe("Fixture first page · Frontend Skeleton"),
);
await waitFor(() =>
expect(
- screen.getByRole("heading", { name: "UI 구성요소", level: 1 }),
+ screen.getByRole("heading", { name: "Fixture first page", level: 1 }),
).toHaveFocus(),
);
});
@@ -180,9 +165,9 @@ describe("generic application router", () => {
})
: undefined,
);
- const link = (
- await screen.findAllByRole("link", { name: "UI 구성요소" })
- )[0]!;
+ const link = within(
+ await screen.findByRole("navigation", { name: "주요 탐색" }),
+ ).getAllByRole("link")[0]!;
link.focus();
navigateByHistory(url);
@@ -230,42 +215,42 @@ describe("generic application router", () => {
// navigation type changes but the screen does not.
const user = userEvent.setup();
const record = vi.fn();
- window.history.pushState({}, "", "/examples/ui");
+ window.history.pushState({}, "", "/fixture/first");
renderRouter({ record });
await waitFor(() =>
expect(
- screen.getByRole("heading", { name: "UI 구성요소", level: 1 }),
+ screen.getByRole("heading", { name: "Fixture first page", level: 1 }),
).toHaveFocus(),
);
const reportsBefore = routeChangeReports(record);
const link = within(
screen.getByRole("navigation", { name: "주요 탐색" }),
- ).getByRole("link", { name: "UI 구성요소" });
+ ).getByRole("link", { name: "Fixture first page" });
await user.click(link);
expect(link).toHaveFocus();
expect(routeChangeReports(record)).toBe(reportsBefore);
});
- it("ignores unknown query parameters on a platform route and keeps the URL", async () => {
+ it("ignores unknown query parameters on a route without a search codec and keeps the URL", async () => {
// D-16: `/?utm_source=x` or an OAuth callback parameter is not an invalid
// address. The `none` codec drops it from the parsed input only.
- window.history.pushState({}, "", "/examples/ui?utm_source=mail#top");
+ window.history.pushState({}, "", "/fixture/first?utm_source=mail#top");
const { container } = renderRouter();
expect(
await screen.findByRole(
"heading",
- { name: "UI 구성요소", level: 1 },
+ { name: "Fixture first page", level: 1 },
),
).toBeVisible();
expect(container.querySelector('[data-surface="invalid-route"]')).toBeNull();
await waitFor(() =>
- expect(document.title).toBe("UI 구성요소 · Frontend Skeleton"),
+ expect(document.title).toBe("Fixture first page · Frontend Skeleton"),
);
expect(`${window.location.pathname}${window.location.search}`).toBe(
- "/examples/ui?utm_source=mail",
+ "/fixture/first?utm_source=mail",
);
});
@@ -278,7 +263,11 @@ describe("generic application router", () => {
window.history.pushState({}, "", "/");
renderRouter();
- for (const label of ["UI 구성요소", "화면 상태", "UI 구성요소"]) {
+ for (const label of [
+ "Fixture first page",
+ "Fixture second page",
+ "Fixture first page",
+ ]) {
await user.click(await screen.findByRole("link", { name: label }));
await waitFor(() =>
expect(
diff --git a/tests/component/runtime-application.test.tsx b/tests/component/runtime-application.test.tsx
index 9a227cee..3412c068 100644
--- a/tests/component/runtime-application.test.tsx
+++ b/tests/component/runtime-application.test.tsx
@@ -7,6 +7,16 @@ import { describe, expect, it, vi } from "vitest";
import { createRuntimeComposition } from "../../src/bootstrap/create-runtime-composition.ts";
import { RuntimeApplication } from "../../src/bootstrap/runtime-application.tsx";
+// The page under test comes from a test-only feature, not the starter home
+// page a product replaces (0929/10-02).
+vi.mock("../../src/.generated/product-feature-index.ts", async () => ({
+ DECLARED_PRODUCT_FEATURE_IDS: ["fixture-feature"],
+ PRODUCT_FEATURE_MODULES: [(await import("../helpers/fixture-feature.tsx")).FIXTURE_FEATURE_MODULE],
+}));
+vi.mock("../../src/.generated/product-context-index.ts", async () => ({
+ PRODUCT_CONTEXT_MODULES: [(await import("../helpers/fixture-feature.tsx")).FIXTURE_CONTEXT_MODULE],
+}));
+
const runtimeConfig = {
APP_ENV: "local",
API_BASE_URL: "http://localhost:8080",
@@ -58,16 +68,14 @@ describe("production runtime application tree", () => {
host: {},
});
- window.history.pushState({}, "", "/");
+ window.history.pushState({}, "", "/fixture/first");
render();
expect(
- await screen.findByRole("heading", {
- name: "Clean Architecture Frontend",
- }),
+ await screen.findByRole("heading", { name: "Fixture first page" }),
).toBeVisible();
expect(
- await screen.findByText("빌드 local-build · 릴리스 local-release"),
+ await screen.findByText("Fixture release local-build · local-release"),
).toBeVisible();
expect(fetcher).toHaveBeenCalledTimes(2);
expect(composition).not.toHaveProperty("ports");
diff --git a/tests/component/starter-pages.test.tsx b/tests/component/starter-pages.test.tsx
new file mode 100644
index 00000000..63090de8
--- /dev/null
+++ b/tests/component/starter-pages.test.tsx
@@ -0,0 +1,117 @@
+// @vitest-environment jsdom
+
+import { render, screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { MemoryRouter } from "react-router-dom";
+import { describe, expect, it, vi } from "vitest";
+
+import { createAnonymousSessionAdapter } from "../../src/adapters/auth/external-session-adapter.ts";
+import StateGalleryPage from "../../src/presentation/examples/state-gallery-page.tsx";
+import { LocaleProvider } from "../../src/presentation/i18n/index.ts";
+import HomePage from "../../src/presentation/pages/home-page.tsx";
+import { ApplicationProvider } from "../../src/presentation/providers/application-provider.tsx";
+import { PreferenceProviders } from "../../src/presentation/providers/preference-providers.tsx";
+import { AppRouter } from "../../src/presentation/routes/app-router.tsx";
+import { createTestApplication } from "../helpers/create-test-application.ts";
+
+/**
+ * The starter screens (`/` and `/examples/*`) are the template's content, not
+ * the platform (0929/10-02). A product that replaces them deletes the
+ * `starter-*.test.tsx` files with them; the platform tests run on the
+ * test-only feature's pages and keep passing.
+ */
+
+function renderApp(
+ url: string,
+ application = createTestApplication(),
+) {
+ window.history.pushState({}, "", url);
+ return render(
+
+
+
+
+ ,
+ );
+}
+
+describe("starter home page", () => {
+ it("reaches the platform overview from the starter actions", async () => {
+ const user = userEvent.setup();
+ renderApp("/");
+
+ await user.click(
+ await screen.findByRole("link", { name: "플랫폼 구성 보기" }),
+ );
+
+ await waitFor(() =>
+ expect(
+ screen.getByRole("heading", { name: "플랫폼 구성", level: 1 }),
+ ).toHaveFocus(),
+ );
+ });
+
+ it("stops the release summary from loading forever", async () => {
+ render(
+ {
+ throw new Error("manifest unavailable");
+ },
+ refresh: async () => {
+ throw new Error("manifest unavailable");
+ },
+ },
+ })}
+ >
+
+ {/* HomePage renders router links, so it needs a router but not the app one. */}
+
+
+
+
+ ,
+ );
+ await waitFor(() =>
+ expect(
+ screen.getByText("런타임 정보를 확인하지 못했습니다."),
+ ).toBeVisible(),
+ );
+ expect(
+ screen.queryByText("검증된 런타임 정보를 확인하고 있습니다."),
+ ).not.toBeInTheDocument();
+ });
+});
+
+describe("starter example pages", () => {
+ it("returns to the current URL with its hash from the auth example page", async () => {
+ const user = userEvent.setup();
+ const beginSignIn = vi.fn(async () => {});
+ renderApp(
+ "/examples/auth#session",
+ createTestApplication({
+ session: { ...createAnonymousSessionAdapter(), beginSignIn },
+ }),
+ );
+
+ await user.click(
+ await screen.findByRole("button", { name: "로그인 시작" }),
+ );
+ expect(beginSignIn).toHaveBeenCalledWith("/examples/auth#session");
+ });
+
+ it("nests the state gallery's titles under the card and section around them (08-05)", () => {
+ render();
+
+ expect(
+ screen.getByRole("heading", { name: "아직 표시할 항목이 없습니다.", level: 4 }),
+ ).toBeVisible();
+ expect(screen.getAllByRole("heading", { level: 3 }).map((h) => h.textContent))
+ .toEqual(expect.arrayContaining(["빈 화면", "복구 가능한 오류"]));
+ // Access states sit directly under the section's h2.
+ expect(
+ screen.queryAllByRole("heading", { level: 2 }).map((h) => h.textContent),
+ ).toEqual(["비동기 데이터 상태", "접근과 탐색 상태"]);
+ });
+});
diff --git a/tests/component/platform-overview-page.test.tsx b/tests/component/starter-platform-overview-page.test.tsx
similarity index 85%
rename from tests/component/platform-overview-page.test.tsx
rename to tests/component/starter-platform-overview-page.test.tsx
index 39360813..4cdbc145 100644
--- a/tests/component/platform-overview-page.test.tsx
+++ b/tests/component/starter-platform-overview-page.test.tsx
@@ -13,6 +13,9 @@ import { createTestApplication } from "../helpers/create-test-application.ts";
import { createRuntimeCapabilitiesStub } from "../helpers/runtime-capabilities-stub.ts";
/**
+ * A starter screen (0929/10-02): a product that replaces `/examples/platform`
+ * deletes this file with it. Platform tests use the test-only feature's pages.
+ *
* The page must stay a projection of the installed registries. Every assertion
* below derives its expectation from the same registry the page reads, so a
* template that removes its sample feature still satisfies this suite.
@@ -161,4 +164,33 @@ describe("platform overview page", () => {
within(metricByLabel(region, "릴리스")).getByText("test-release"),
).toBeVisible();
});
+
+ it("stops the release metrics from loading forever", async () => {
+ render(
+ {
+ throw new Error("manifest unavailable");
+ },
+ refresh: async () => {
+ throw new Error("manifest unavailable");
+ },
+ },
+ })}
+ >
+
+
+
+ ,
+ );
+ await waitFor(() =>
+ expect(
+ screen.getByText("런타임 정보를 확인하지 못했습니다."),
+ ).toBeVisible(),
+ );
+ expect(
+ screen.queryByText("런타임 정보를 확인하고 있습니다."),
+ ).not.toBeInTheDocument();
+ });
});
diff --git a/tests/helpers/fixture-feature.tsx b/tests/helpers/fixture-feature.tsx
index 8e5158ee..2ff08cfa 100644
--- a/tests/helpers/fixture-feature.tsx
+++ b/tests/helpers/fixture-feature.tsx
@@ -1,14 +1,22 @@
+import { type ComponentType, lazy, useEffect, useState } from "react";
import { type RouteObject, useSearchParams } from "react-router-dom";
import { z } from "zod";
import { defineBoundedContextModule } from "../../src/contexts/bounded-context-module.ts";
import { defineFeatureModule } from "../../src/features/feature-module.ts";
+// Not the design-system barrel: it reaches the installed catalogs, whose
+// generated index the tests mock with this module, and the mock would wait on
+// itself.
+import { PageHeader } from "../../src/presentation/components/page-header.tsx";
+import { useApplicationRuntime } from "../../src/presentation/providers/application-provider.tsx";
/**
- * A test-only product feature for platform tests that need a feature route: one
- * that requires a session, parses a search codec, and belongs to a feature the
- * runtime can switch off. Those tests install it by mocking the generated
- * indexes, so they do not depend on the removable sample feature (FE-GATE-020):
+ * A test-only product feature for platform tests that need routes and pages of
+ * their own: routes that require a session and parse a search codec, public
+ * pages in the primary navigation, and pages that fail to render. Those tests
+ * install it by mocking the generated indexes, so they depend neither on the
+ * removable sample feature (FE-GATE-020) nor on the starter screens a product
+ * replaces (`/`, `/examples/*`; 0929/10-02):
*
* vi.mock("../../src/.generated/product-feature-index.ts", async () => ({
* DECLARED_PRODUCT_FEATURE_IDS: ["fixture-feature"],
@@ -41,16 +49,42 @@ function fixtureRoute(
});
}
+/** A public page like the starter pages: route boundary, optional menu entry. */
+function publicFixtureRoute(
+ routeId: string,
+ path: string,
+ chunkId: string,
+ navigationOrder: number | null,
+) {
+ return Object.freeze({
+ ...fixtureRoute(routeId, path, null, chunkId),
+ access: "public" as const,
+ errorSurface: "route-boundary",
+ navigationLabel: navigationOrder === null ? null : routeId,
+ navigationOrder,
+ });
+}
+
const FIXTURE_ROUTES = Object.freeze({
FIXTURE_ITEMS: fixtureRoute("FIXTURE_ITEMS", "/fixture/items", "FixtureItemsQuery", "route-fixture-items"),
FIXTURE_ITEM_STATUS: fixtureRoute("FIXTURE_ITEM_STATUS", "/fixture/items/status", null, "route-fixture-item-status"),
FIXTURE_ITEM_FORM: fixtureRoute("FIXTURE_ITEM_FORM", "/fixture/items/new", null, "route-fixture-item-form"),
+ FIXTURE_FIRST_PAGE: publicFixtureRoute("FIXTURE_FIRST_PAGE", "/fixture/first", "route-fixture-first", 900),
+ FIXTURE_SECOND_PAGE: publicFixtureRoute("FIXTURE_SECOND_PAGE", "/fixture/second", "route-fixture-second", 910),
+ FIXTURE_OFFLINE_PAGE: publicFixtureRoute("FIXTURE_OFFLINE_PAGE", "/fixture/offline", "route-fixture-offline", null),
+ FIXTURE_BROKEN_PAGE: publicFixtureRoute("FIXTURE_BROKEN_PAGE", "/fixture/broken", "route-fixture-broken", null),
});
-const FIXTURE_TITLES: Readonly> = {
+type FixtureRouteId = keyof typeof FIXTURE_ROUTES;
+
+const FIXTURE_TITLES: Readonly> = {
FIXTURE_ITEMS: "Fixture items",
FIXTURE_ITEM_STATUS: "Fixture item status",
FIXTURE_ITEM_FORM: "Create fixture item",
+ FIXTURE_FIRST_PAGE: "Fixture first page",
+ FIXTURE_SECOND_PAGE: "Fixture second page",
+ FIXTURE_OFFLINE_PAGE: "Fixture offline page",
+ FIXTURE_BROKEN_PAGE: "Fixture broken page",
};
const FIXTURE_MESSAGES = Object.freeze(
@@ -127,18 +161,78 @@ function FixturePage() {
);
}
+/**
+ * A lazily loaded page that opens with its heading and shows the release the
+ * runtime resolved, the way a product page does. Lazy, so a first visit
+ * suspends on the route loading surface and a later visit renders at once.
+ */
+function titledPage(title: string): ComponentType {
+ return lazy(async () => ({
+ default: function FixtureTitledPage() {
+ const runtime = useApplicationRuntime();
+ const [release, setRelease] = useState(null);
+ useEffect(() => {
+ let active = true;
+ runtime.getReleaseSummary().then(
+ (summary) => {
+ if (active) {
+ setRelease(`Fixture release ${summary.buildId} · ${summary.releaseId}`);
+ }
+ },
+ () => {},
+ );
+ return () => {
+ active = false;
+ };
+ }, [runtime]);
+ return (
+
+
+ {release === null ? null : {release}
}
+
+ );
+ },
+ }));
+}
+
+/** A route chunk the network could not deliver: the rejection rethrows on every render. */
+function OfflineChunkPage(): never {
+ throw new TypeError(
+ "Failed to fetch dynamically imported module: /assets/fixture-offline.js",
+ );
+}
+
+/** A route page with a programmer defect. */
+function BrokenPage(): never {
+ throw new Error("ordinary render defect");
+}
+
+const FIXTURE_PAGES: Readonly> = {
+ FIXTURE_ITEMS: FixturePage,
+ FIXTURE_ITEM_STATUS: FixturePage,
+ FIXTURE_ITEM_FORM: FixturePage,
+ FIXTURE_FIRST_PAGE: titledPage(FIXTURE_TITLES.FIXTURE_FIRST_PAGE),
+ FIXTURE_SECOND_PAGE: titledPage(FIXTURE_TITLES.FIXTURE_SECOND_PAGE),
+ FIXTURE_OFFLINE_PAGE: OfflineChunkPage,
+ FIXTURE_BROKEN_PAGE: BrokenPage,
+};
+
export const FIXTURE_CONTEXT_ROUTES: readonly RouteObject[] = Object.freeze(
- Object.values(FIXTURE_ROUTES).map((route) =>
- Object.freeze({
+ (Object.keys(FIXTURE_ROUTES) as FixtureRouteId[]).map((routeId) => {
+ const route = FIXTURE_ROUTES[routeId];
+ return Object.freeze({
id: route.routeId,
path: route.path,
handle: Object.freeze({
routeId: route.routeId,
- runtime: Object.freeze({ moduleId: `${route.chunkId}-page`, Component: FixturePage }),
+ runtime: Object.freeze({
+ moduleId: `${route.chunkId}-page`,
+ Component: FIXTURE_PAGES[routeId],
+ }),
codecs: FIXTURE_ROUTE_CODECS,
}),
- }),
- ),
+ });
+ }),
);
export const FIXTURE_CONTEXT_MODULE = defineBoundedContextModule({
@@ -146,7 +240,7 @@ export const FIXTURE_CONTEXT_MODULE = defineBoundedContextModule({
features: [FIXTURE_FEATURE_MODULE],
budget: { maxFeatures: 1 },
route: {
- path: "fixture/items/*",
+ path: "fixture/*",
loadRoutes: async () => FIXTURE_CONTEXT_ROUTES,
},
});