huskies: merge 622_story_wrap_react_state_updates_in_act_to_silence_frontend_test_warnings
This commit is contained in:
@@ -165,7 +165,7 @@ describe("Chat message rendering — unified tool call UI", () => {
|
||||
},
|
||||
];
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onUpdate(messages);
|
||||
});
|
||||
|
||||
@@ -199,7 +199,7 @@ describe("Chat message rendering — unified tool call UI", () => {
|
||||
{ role: "assistant", content: "The file contains a main function." },
|
||||
];
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onUpdate(messages);
|
||||
});
|
||||
|
||||
@@ -219,7 +219,7 @@ describe("Chat message rendering — unified tool call UI", () => {
|
||||
{ role: "assistant", content: "Hi there! How can I help?" },
|
||||
];
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onUpdate(messages);
|
||||
});
|
||||
|
||||
@@ -254,7 +254,7 @@ describe("Chat message rendering — unified tool call UI", () => {
|
||||
},
|
||||
];
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onUpdate(messages);
|
||||
});
|
||||
|
||||
@@ -396,7 +396,7 @@ describe("Chat reconciliation banner", () => {
|
||||
|
||||
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onReconciliationProgress(
|
||||
"42_story_test",
|
||||
"checking",
|
||||
@@ -417,7 +417,7 @@ describe("Chat reconciliation banner", () => {
|
||||
|
||||
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onReconciliationProgress(
|
||||
"42_story_test",
|
||||
"gates_running",
|
||||
@@ -435,7 +435,7 @@ describe("Chat reconciliation banner", () => {
|
||||
|
||||
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onReconciliationProgress(
|
||||
"42_story_test",
|
||||
"checking",
|
||||
@@ -447,7 +447,7 @@ describe("Chat reconciliation banner", () => {
|
||||
await screen.findByTestId("reconciliation-banner"),
|
||||
).toBeInTheDocument();
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onReconciliationProgress(
|
||||
"",
|
||||
"done",
|
||||
@@ -504,7 +504,7 @@ describe("Chat localStorage persistence (Story 145)", () => {
|
||||
{ role: "assistant", content: "Hi there!" },
|
||||
];
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onUpdate(history);
|
||||
});
|
||||
|
||||
@@ -555,7 +555,7 @@ describe("Chat localStorage persistence (Story 145)", () => {
|
||||
{ role: "assistant", content: "I should survive a reload" },
|
||||
];
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onUpdate(history);
|
||||
});
|
||||
|
||||
@@ -604,7 +604,7 @@ describe("Chat localStorage persistence (Story 145)", () => {
|
||||
{ role: "user", content: "What is Rust?" },
|
||||
{ role: "assistant", content: "Rust is a systems programming language." },
|
||||
];
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onUpdate(priorHistory);
|
||||
});
|
||||
|
||||
@@ -692,12 +692,12 @@ describe("Chat activity status indicator (Bug 140)", () => {
|
||||
});
|
||||
|
||||
// Simulate tokens arriving (streamingContent becomes non-empty)
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onToken("I'll read that file for you.");
|
||||
});
|
||||
|
||||
// Now simulate a tool activity event while streamingContent is non-empty
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onActivity("read_file");
|
||||
});
|
||||
|
||||
@@ -742,7 +742,7 @@ describe("Chat activity status indicator (Bug 140)", () => {
|
||||
});
|
||||
|
||||
// Tokens arrive — streamingContent is non-empty, no activity
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onToken("Here is my response...");
|
||||
});
|
||||
|
||||
@@ -765,12 +765,12 @@ describe("Chat activity status indicator (Bug 140)", () => {
|
||||
});
|
||||
|
||||
// Simulate tokens arriving
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onToken("Let me read that.");
|
||||
});
|
||||
|
||||
// Claude Code sends tool name "Read" (not "read_file")
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onActivity("Read");
|
||||
});
|
||||
|
||||
@@ -792,11 +792,11 @@ describe("Chat activity status indicator (Bug 140)", () => {
|
||||
fireEvent.keyDown(input, { key: "Enter", shiftKey: false });
|
||||
});
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onToken("Running tests now.");
|
||||
});
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onActivity("Bash");
|
||||
});
|
||||
|
||||
@@ -818,11 +818,11 @@ describe("Chat activity status indicator (Bug 140)", () => {
|
||||
fireEvent.keyDown(input, { key: "Enter", shiftKey: false });
|
||||
});
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onToken("Working on it.");
|
||||
});
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onActivity("SomeCustomTool");
|
||||
});
|
||||
|
||||
@@ -899,7 +899,7 @@ describe("Chat message queue (Story 155)", () => {
|
||||
).toBeInTheDocument();
|
||||
|
||||
// Simulate agent response completing (loading → false)
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onUpdate([
|
||||
{ role: "user", content: "First" },
|
||||
{ role: "assistant", content: "Done." },
|
||||
@@ -1066,7 +1066,7 @@ describe("Chat message queue (Story 155)", () => {
|
||||
expect(indicators[1]).toHaveTextContent("Third");
|
||||
|
||||
// Simulate first response completing — both "Second" and "Third" are drained at once
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onUpdate([
|
||||
{ role: "user", content: "First" },
|
||||
{ role: "assistant", content: "Response 1." },
|
||||
@@ -1145,7 +1145,7 @@ describe("Remove bubble styling from streaming messages (Story 163)", () => {
|
||||
});
|
||||
|
||||
// Simulate streaming tokens arriving
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onToken("Streaming response text");
|
||||
});
|
||||
|
||||
@@ -1176,7 +1176,7 @@ describe("Remove bubble styling from streaming messages (Story 163)", () => {
|
||||
fireEvent.keyDown(input, { key: "Enter", shiftKey: false });
|
||||
});
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onToken("Some markdown content");
|
||||
});
|
||||
|
||||
@@ -1200,7 +1200,7 @@ describe("Remove bubble styling from streaming messages (Story 163)", () => {
|
||||
});
|
||||
|
||||
// Simulate streaming tokens
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onToken("Final response");
|
||||
});
|
||||
|
||||
@@ -1211,7 +1211,7 @@ describe("Remove bubble styling from streaming messages (Story 163)", () => {
|
||||
const streamingStyleAttr = streamingStyledDiv.getAttribute("style") ?? "";
|
||||
|
||||
// Transition: onUpdate completes the message
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onUpdate([
|
||||
{ role: "user", content: "Hello" },
|
||||
{ role: "assistant", content: "Final response" },
|
||||
@@ -1244,7 +1244,7 @@ describe("Remove bubble styling from streaming messages (Story 163)", () => {
|
||||
|
||||
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onUpdate([
|
||||
{ role: "user", content: "Hi" },
|
||||
{ role: "assistant", content: "Hello there!" },
|
||||
@@ -1268,7 +1268,7 @@ describe("Remove bubble styling from streaming messages (Story 163)", () => {
|
||||
|
||||
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onUpdate([
|
||||
{ role: "user", content: "I am a user message" },
|
||||
{ role: "assistant", content: "I am a response" },
|
||||
@@ -1310,7 +1310,7 @@ describe("Bug 264: Claude Code session ID persisted across browser refresh", ()
|
||||
|
||||
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onSessionId("test-session-abc");
|
||||
});
|
||||
|
||||
@@ -1394,7 +1394,7 @@ describe("Bug 264: Claude Code session ID persisted across browser refresh", ()
|
||||
render(<Chat projectPath={PROJECT_PATH} onCloseProject={vi.fn()} />);
|
||||
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onSessionId("my-session");
|
||||
});
|
||||
|
||||
@@ -1595,7 +1595,7 @@ describe("Slash command handling (Story 374)", () => {
|
||||
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
|
||||
|
||||
// First add a message so there is history to clear
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onUpdate([
|
||||
{ role: "user", content: "hello" },
|
||||
{ role: "assistant", content: "world" },
|
||||
@@ -1701,7 +1701,7 @@ describe("Bug 450: WebSocket error messages displayed in chat", () => {
|
||||
|
||||
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onError("Something went wrong on the server.");
|
||||
});
|
||||
|
||||
@@ -1715,7 +1715,7 @@ describe("Bug 450: WebSocket error messages displayed in chat", () => {
|
||||
|
||||
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
capturedWsHandlers?.onError(
|
||||
"OAuth login required. Please visit: https://example.com/oauth/login",
|
||||
);
|
||||
|
||||
@@ -138,7 +138,7 @@ describe("usePathCompletion hook", () => {
|
||||
expect(result.current.matchList[0].name).toBe("Documents");
|
||||
});
|
||||
|
||||
it("calls setPathInput when acceptMatch is invoked", () => {
|
||||
it("calls setPathInput when acceptMatch is invoked", async () => {
|
||||
const setPathInput = vi.fn();
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
@@ -151,7 +151,7 @@ describe("usePathCompletion hook", () => {
|
||||
}),
|
||||
);
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
result.current.acceptMatch("/home/user/Documents/");
|
||||
});
|
||||
|
||||
@@ -308,14 +308,14 @@ describe("usePathCompletion hook", () => {
|
||||
expect(result.current.matchList.length).toBe(2);
|
||||
});
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
result.current.acceptSelectedMatch();
|
||||
});
|
||||
|
||||
expect(setPathInput).toHaveBeenCalledWith("/home/user/Documents/");
|
||||
});
|
||||
|
||||
it("acceptSelectedMatch does nothing when matchList is empty", () => {
|
||||
it("acceptSelectedMatch does nothing when matchList is empty", async () => {
|
||||
const setPathInput = vi.fn();
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
@@ -328,7 +328,7 @@ describe("usePathCompletion hook", () => {
|
||||
}),
|
||||
);
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
result.current.acceptSelectedMatch();
|
||||
});
|
||||
|
||||
@@ -352,7 +352,7 @@ describe("usePathCompletion hook", () => {
|
||||
expect(result.current.matchList.length).toBe(1);
|
||||
});
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
result.current.closeSuggestions();
|
||||
});
|
||||
|
||||
@@ -450,7 +450,7 @@ describe("usePathCompletion hook", () => {
|
||||
expect(result.current.matchList.length).toBe(2);
|
||||
});
|
||||
|
||||
act(() => {
|
||||
await act(async () => {
|
||||
result.current.setSelectedMatch(1);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user