From d509ad59b41f62336341268b5567e34a84a24be6 Mon Sep 17 00:00:00 2001 From: isaka1022 Date: Sun, 28 Jun 2026 18:52:25 +0200 Subject: [PATCH] test(web): cover standalone response entry in HistoryEntry status tests Acceptance criterion #3 of #1439 ("a standalone response entry isn't shown as Pending") was not tested. Add a `standaloneResponseEntry` fixture with `direction: "response"` and assert that no Pending/OK/Error badge appears, consistent with the existing extractStatus fix that scopes the request lifecycle to `direction === "request"` only. --- .../groups/HistoryEntry/HistoryEntry.test.tsx | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/clients/web/src/components/groups/HistoryEntry/HistoryEntry.test.tsx b/clients/web/src/components/groups/HistoryEntry/HistoryEntry.test.tsx index 6ed5e7699..a4969a265 100644 --- a/clients/web/src/components/groups/HistoryEntry/HistoryEntry.test.tsx +++ b/clients/web/src/components/groups/HistoryEntry/HistoryEntry.test.tsx @@ -107,6 +107,21 @@ const notificationEntry: MessageEntry = { }, }; +// A standalone direction:"response" entry (e.g. the client's answer to a +// server→client request such as roots/list or sampling) — no request-style +// status badge should appear; "Pending" in particular would be misleading. +const standaloneResponseEntry: MessageEntry = { + id: "resp-1", + timestamp: new Date("2026-03-17T10:37:00Z"), + direction: "response", + origin: "client", + message: { + jsonrpc: "2.0", + id: 10, + result: { roots: [] }, + }, +}; + const baseProps = { isPinned: false, isListExpanded: false, @@ -153,6 +168,17 @@ describe("HistoryEntry", () => { expect(screen.queryByText("Error")).not.toBeInTheDocument(); }); + it("renders no request-style status badge for a standalone response entry", () => { + renderWithMantine( + , + ); + // A standalone direction:"response" (e.g. client answering roots/list or + // sampling) carries no request lifecycle — no Pending/OK/Error badge. + expect(screen.queryByText("Pending")).not.toBeInTheDocument(); + expect(screen.queryByText("OK")).not.toBeInTheDocument(); + expect(screen.queryByText("Error")).not.toBeInTheDocument(); + }); + it("shows client → server for a client-originated entry", () => { renderWithMantine(); expect(screen.getByText("client → server")).toBeInTheDocument();