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:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user