story-kit: merge 199_story_web_ui_submits_all_queued_items_at_once
This commit is contained in:
@@ -851,7 +851,7 @@ describe("Chat message queue (Story 155)", () => {
|
||||
expect(indicators[1]).toHaveTextContent("Queue 2");
|
||||
});
|
||||
|
||||
it("queued messages are delivered in order (Bug 168)", async () => {
|
||||
it("all queued messages are drained at once when agent responds (Story 199)", async () => {
|
||||
render(<Chat projectPath="/tmp/project" onCloseProject={vi.fn()} />);
|
||||
|
||||
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
|
||||
@@ -866,7 +866,7 @@ describe("Chat message queue (Story 155)", () => {
|
||||
fireEvent.keyDown(input, { key: "Enter", shiftKey: false });
|
||||
});
|
||||
|
||||
// Queue two messages
|
||||
// Queue two messages while loading
|
||||
await act(async () => {
|
||||
fireEvent.change(input, { target: { value: "Second" } });
|
||||
});
|
||||
@@ -886,7 +886,7 @@ describe("Chat message queue (Story 155)", () => {
|
||||
expect(indicators[0]).toHaveTextContent("Second");
|
||||
expect(indicators[1]).toHaveTextContent("Third");
|
||||
|
||||
// Simulate first response completing — "Second" is sent next
|
||||
// Simulate first response completing — both "Second" and "Third" are drained at once
|
||||
act(() => {
|
||||
capturedWsHandlers?.onUpdate([
|
||||
{ role: "user", content: "First" },
|
||||
@@ -894,11 +894,10 @@ describe("Chat message queue (Story 155)", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
// "Third" should remain queued; "Second" was consumed
|
||||
// Both queued indicators should be gone — entire queue drained in one shot
|
||||
await waitFor(() => {
|
||||
const remaining = screen.queryAllByTestId("queued-message-indicator");
|
||||
expect(remaining).toHaveLength(1);
|
||||
expect(remaining[0]).toHaveTextContent("Third");
|
||||
expect(remaining).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user