diff --git a/src/presentation/layouts/app-shell.tsx b/src/presentation/layouts/app-shell.tsx
index 1c698e2e..bf59bebe 100644
--- a/src/presentation/layouts/app-shell.tsx
+++ b/src/presentation/layouts/app-shell.tsx
@@ -3,11 +3,7 @@ import { NavLink, Outlet, useLocation } from "react-router-dom";
import type { SessionState } from "../../application/ports/in/application-api.ts";
import { normalizeColorSchemePreference } from "../../application/policies/color-scheme.ts";
-import {
- NAVIGATION_ROUTES,
- ROUTE_FEATURE_OWNER,
- routePath,
-} from "../../features/installed-feature-contracts.ts";
+import { routePath } from "../../features/installed-feature-contracts.ts";
import {
Button,
Drawer,
@@ -26,6 +22,7 @@ import {
useSessionAction,
} from "../providers/session-provider.tsx";
import { useTheme } from "../providers/theme-provider.tsx";
+import { activeNavigationRoutes } from "../routes/navigation-policy.ts";
const SESSION_MESSAGE_KEYS = Object.freeze({
authenticated: "shell.session.authenticated",
@@ -196,10 +193,9 @@ function PrimaryNavigation({
const runtime = useApplicationRuntime();
// §3.5. A feature the runtime document disabled does not advertise itself.
// The router refuses its routes too, so this is presentation, not the switch.
- const routes = NAVIGATION_ROUTES.filter((definition) => {
- const owner = ROUTE_FEATURE_OWNER[definition.routeId];
- return owner === undefined || runtime.isFeatureActive(owner);
- });
+ const routes = activeNavigationRoutes((featureId) =>
+ runtime.isFeatureActive(featureId),
+ );
return (
- {STARTER_ROUTES.length > 0 ? (
+ {starterRoutes.length > 0 ? (
{message("home.starter.title")}
{message("home.starter.description")}
- {STARTER_ROUTES.map((route, index) => (
+ {starterRoutes.map((route, index) => (
boolean,
+): typeof NAVIGATION_ROUTES {
+ return NAVIGATION_ROUTES.filter((definition) => {
+ const owner = ROUTE_FEATURE_OWNER[definition.routeId];
+ return owner === undefined || isFeatureActive(owner);
+ });
+}
export type RouteAccessDecision =
| Readonly<{ allowed: true; action: "none" }>
diff --git a/tests/features/platform-examples-feature/example-pages.test.tsx b/tests/features/platform-examples-feature/example-pages.test.tsx
index 017a1d66..03e51085 100644
--- a/tests/features/platform-examples-feature/example-pages.test.tsx
+++ b/tests/features/platform-examples-feature/example-pages.test.tsx
@@ -1,15 +1,21 @@
// @vitest-environment jsdom
-import { render, screen, waitFor } from "@testing-library/react";
+import { render, screen, waitFor, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { describe, expect, it, vi } from "vitest";
import { createAnonymousSessionAdapter } from "../../../src/adapters/auth/external-session-adapter.ts";
+import {
+ ROUTE_FEATURE_OWNER,
+ ROUTE_REGISTRY,
+} from "../../../src/features/installed-feature-contracts.ts";
+import { PLATFORM_EXAMPLES_FEATURE_ID } from "../../../src/features/platform-examples-feature/contracts/platform-examples-contract.ts";
import StateGalleryPage from "../../../src/features/platform-examples-feature/presentation/state-gallery-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";
+import { createProductFeaturesStub } from "../../helpers/runtime-capabilities-stub.ts";
/**
* The example screens (`/examples/ui`, `/examples/states`, `/examples/auth`)
@@ -48,6 +54,37 @@ describe("example pages", () => {
);
});
+ // 1105/08-03. The home page's starter links read the same switch as the
+ // shell's navigation: switched off at runtime, this feature's screens are
+ // not offered there, and the next active screens take their place.
+ it("leaves this feature's screens out of the home page's starter links when it is switched off", async () => {
+ renderApp(
+ "/",
+ createTestApplication({
+ productFeatures: createProductFeaturesStub({
+ [PLATFORM_EXAMPLES_FEATURE_ID]: "DISABLED_BY_CONFIG",
+ }),
+ }),
+ );
+
+ const starter = await screen.findByRole("region", { name: "준비된 화면 살펴보기" });
+ const starterPaths = within(starter)
+ .getAllByRole("link")
+ .map((link) => link.getAttribute("href"));
+ const ownPaths = Object.values(ROUTE_REGISTRY)
+ .filter((route) => ROUTE_FEATURE_OWNER[route.routeId] === PLATFORM_EXAMPLES_FEATURE_ID)
+ .map((route) => route.path);
+ const [navigation] = screen.getAllByRole("navigation", { name: "주요 탐색" });
+ const advertised = within(navigation!)
+ .getAllByRole("link")
+ .map((link) => link.getAttribute("href"))
+ .filter((path) => path !== "/");
+
+ expect(ownPaths.length).toBeGreaterThan(0);
+ expect(starterPaths.some((path) => ownPaths.includes(path ?? ""))).toBe(false);
+ expect(starterPaths).toEqual(advertised.slice(0, 3));
+ });
+
it("returns to the current URL with its hash from the auth example page", async () => {
const user = userEvent.setup();
const beginSignIn = vi.fn(async () => {});