fix: update /help test to expect botCommand dispatch, fix PTY fd leak in claude_code.rs (#451, #452)

The /help test expected the help overlay to appear, but /help now goes
through botCommand like other slash commands. Updated the test to match.

Also added reader thread join and child.wait() calls to
claude_code.rs to prevent PTY master fd leaks from web UI chat sessions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dave
2026-03-31 14:48:47 +00:00
parent f16545ec36
commit dc4bac3a85
2 changed files with 15 additions and 4 deletions
+9 -3
View File
@@ -1642,7 +1642,8 @@ describe("Slash command handling (Story 374)", () => {
expect(mockedApi.botCommand).not.toHaveBeenCalled();
});
it("AC: /help shows help overlay", async () => {
it("AC: /help calls botCommand and displays response", async () => {
mockedApi.botCommand.mockResolvedValue({ response: "Available commands: status, help, ..." });
render(<Chat projectPath="/tmp/project" onCloseProject={vi.fn()} />);
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
@@ -1658,9 +1659,14 @@ describe("Slash command handling (Story 374)", () => {
fireEvent.keyDown(input, { key: "Enter", shiftKey: false });
});
expect(await screen.findByTestId("help-overlay")).toBeInTheDocument();
await waitFor(() => {
expect(mockedApi.botCommand).toHaveBeenCalledWith(
"help",
"",
undefined,
);
});
expect(lastSendChatArgs).toBeNull();
expect(mockedApi.botCommand).not.toHaveBeenCalled();
});
it("AC: botCommand API error shows error message in chat", async () => {