fix(web): authorities unknown-kind redirect, extract labelText util, EN-required test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-04 09:39:15 +02:00
parent 38673e52ba
commit 352d899fa5
4 changed files with 42 additions and 24 deletions
+20
View File
@@ -35,3 +35,23 @@ test("kind tabs link to the other kinds", async () => {
renderApp(tree(), { route: "/authorities/person" });
expect(await screen.findByRole("link", { name: /place/i })).toHaveAttribute("href", "/authorities/place");
});
test("create without EN label shows required alert and does not POST", async () => {
let posted = false;
server.use(
http.post("/api/admin/authorities", () => {
posted = true;
return HttpResponse.json({ id: "a-x" }, { status: 201 });
}),
);
renderApp(tree(), { route: "/authorities/person" });
expect(await screen.findByText("Ada Lovelace")).toBeInTheDocument();
await userEvent.click(screen.getByRole("button", { name: /create/i }));
expect(screen.getByRole("alert")).toBeInTheDocument();
expect(posted).toBe(false);
});
test("unknown kind redirects to person list", async () => {
renderApp(tree(), { route: "/authorities/banana" });
expect(await screen.findByText("Ada Lovelace")).toBeInTheDocument();
});