Takes over the identity the template left generic. The application name becomes Memento in the browser title, the shell header and the home page, in both the Korean and English catalogs. The browser storage namespace moves from `ca-frontend` to `memento`, which also moves the OPFS root directory, its mutation lock and the journal metadata prefix. Nothing is migrated, because this repository has never been deployed and so no origin holds data under the old prefix. The tests that assert those key strings move with them. Release provenance needs no edit here: the builder and verifier ids are derived from the `name` in package.json upstream, so changing that one line renames them too. The template name is left alone in docs/, where it is part of the record of work that actually happened in that repository, and in the secret scan tool id, which is an internal identifier matched by a validator on both sides rather than a product name. README.md now describes this repository and, more importantly, records how to merge from upstream and exactly which files carry a memento value and will therefore be where conflicts land. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
103 lines
3.4 KiB
TypeScript
103 lines
3.4 KiB
TypeScript
// @vitest-environment jsdom
|
|
|
|
import { render, screen, waitFor } from "@testing-library/react";
|
|
import userEvent from "@testing-library/user-event";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import { createAnonymousSessionAdapter } from "../../src/adapters/auth/external-session-adapter.ts";
|
|
import { ApplicationProvider } from "../../src/presentation/providers/application-provider.tsx";
|
|
import { AppRouter } from "../../src/presentation/routes/app-router.tsx";
|
|
import { createTestApplication } from "../helpers/create-test-application.ts";
|
|
|
|
function renderRouter() {
|
|
return render(
|
|
<ApplicationProvider
|
|
application={createTestApplication({
|
|
session: createAnonymousSessionAdapter(),
|
|
})}
|
|
>
|
|
<AppRouter />
|
|
</ApplicationProvider>,
|
|
);
|
|
}
|
|
|
|
describe("generic application router", () => {
|
|
it("reaches the platform overview from the home starter actions", async () => {
|
|
const user = userEvent.setup();
|
|
window.history.pushState({}, "", "/");
|
|
renderRouter();
|
|
|
|
// The starter action lives inside the lazily loaded home chunk, so this is
|
|
// the first wait in the file that has to outlast a chunk load rather than
|
|
// an already-mounted shell element.
|
|
await user.click(
|
|
await screen.findByRole(
|
|
"link",
|
|
{ name: "플랫폼 구성 보기" },
|
|
{ timeout: 5000 },
|
|
),
|
|
);
|
|
|
|
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();
|
|
|
|
expect(
|
|
await screen.findByRole("heading", {
|
|
name: "페이지를 찾을 수 없습니다.",
|
|
}),
|
|
).toBeVisible();
|
|
expect(screen.getByRole("navigation", { name: "주요 탐색" })).toBeVisible();
|
|
expect(screen.getByRole("main")).toBeVisible();
|
|
});
|
|
|
|
it("navigates between registry-backed platform routes", async () => {
|
|
const user = userEvent.setup();
|
|
window.history.pushState({}, "", "/");
|
|
renderRouter();
|
|
|
|
await user.click(
|
|
await screen.findByRole("link", { name: "UI 구성요소" }),
|
|
);
|
|
|
|
expect(
|
|
await screen.findByRole("heading", { name: "UI 구성요소", level: 1 }),
|
|
).toBeVisible();
|
|
expect(window.location.pathname).toBe("/examples/ui");
|
|
await waitFor(() =>
|
|
expect(document.title).toBe("UI 구성요소 · Memento"),
|
|
);
|
|
await waitFor(() =>
|
|
expect(
|
|
screen.getByRole("heading", { name: "UI 구성요소", level: 1 }),
|
|
).toHaveFocus(),
|
|
);
|
|
});
|
|
|
|
it("focuses the route heading again when the lazy chunk is already cached", async () => {
|
|
// §9.7. The first visit resolves the route module asynchronously, so the
|
|
// router lifecycle and the page header commit separately. A later visit
|
|
// renders the cached module in the same commit, which is the ordering that
|
|
// must still hand focus to the heading rather than leaving it on main.
|
|
const user = userEvent.setup();
|
|
window.history.pushState({}, "", "/");
|
|
renderRouter();
|
|
|
|
for (const label of ["UI 구성요소", "화면 상태", "UI 구성요소"]) {
|
|
await user.click(await screen.findByRole("link", { name: label }));
|
|
await waitFor(() =>
|
|
expect(
|
|
screen.getByRole("heading", { name: label, level: 1 }),
|
|
).toHaveFocus(),
|
|
);
|
|
}
|
|
});
|
|
});
|