feat(frontend): collapsible group headers; resume/delete integration tests; English test name
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import userEvent from "@testing-library/user-event";
|
||||
import { http, HttpResponse } from "msw";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { server } from "../test/msw";
|
||||
import { FakeEventSource } from "../test/fakeEventSource";
|
||||
import { AppShell } from "./AppShell";
|
||||
|
||||
function wrap() {
|
||||
@@ -16,6 +17,8 @@ const LIST = [
|
||||
];
|
||||
|
||||
beforeEach(() => {
|
||||
FakeEventSource.instances = [];
|
||||
(globalThis as any).EventSource = FakeEventSource;
|
||||
server.use(
|
||||
http.get("http://localhost:8787/sessions", () => HttpResponse.json(LIST)),
|
||||
http.get("http://localhost:8787/sessions/:id/documents", () => HttpResponse.json([
|
||||
@@ -43,3 +46,19 @@ test("Archive toggle reveals archived sessions", async () => {
|
||||
await userEvent.click(await screen.findByRole("button", { name: /archive/i }));
|
||||
expect(await screen.findByText("Archiviata due")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("Resume from the panel activates the session and closes the panel", async () => {
|
||||
let resumed: string | null = null;
|
||||
server.use(
|
||||
http.post("http://localhost:8787/sessions/:id/resume", ({ params }) => {
|
||||
resumed = params.id as string;
|
||||
return new HttpResponse(null, { status: 204 });
|
||||
}),
|
||||
);
|
||||
wrap();
|
||||
await userEvent.click(await screen.findByText("Attiva uno"));
|
||||
await screen.findByText("Domanda originale"); // panel open
|
||||
await userEvent.click(screen.getByRole("button", { name: /resume/i }));
|
||||
await waitFor(() => expect(resumed).toBe("s1"));
|
||||
await waitFor(() => expect(screen.queryByText("Domanda originale")).not.toBeInTheDocument()); // panel closed
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user