storkit: merge 450_bug_web_ui_silently_swallows_chat_errors_including_oauth_login_link

This commit is contained in:
dave
2026-03-31 14:56:13 +00:00
parent 5f0680c6c1
commit 16f9722851
2 changed files with 45 additions and 0 deletions
+37
View File
@@ -1691,3 +1691,40 @@ describe("Slash command handling (Story 374)", () => {
).toBeInTheDocument();
});
});
describe("Bug 450: WebSocket error messages displayed in chat", () => {
beforeEach(() => {
capturedWsHandlers = null;
setupMocks();
});
it("AC1: WebSocket error message is shown in chat as an assistant message", async () => {
render(<Chat projectPath="/tmp/project" onCloseProject={vi.fn()} />);
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
act(() => {
capturedWsHandlers?.onError("Something went wrong on the server.");
});
expect(
await screen.findByText("Something went wrong on the server."),
).toBeInTheDocument();
});
it("AC2: OAuth login URL in WebSocket error is rendered as a clickable link", async () => {
render(<Chat projectPath="/tmp/project" onCloseProject={vi.fn()} />);
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
act(() => {
capturedWsHandlers?.onError(
"OAuth login required. Please visit: https://example.com/oauth/login",
);
});
const link = await screen.findByRole("link", { name: /https:\/\/example\.com\/oauth\/login/ });
expect(link).toBeInTheDocument();
expect(link).toHaveAttribute("href", "https://example.com/oauth/login");
});
});