From e9f762560f2713e6afecc1c11f7ee7365fbdbafe Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Sun, 4 Oct 2026 05:30:51 -0700 Subject: [PATCH] test(native-chat): the delivery tests send under main's fake clock and read C2's notices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The merge with main kept both versions of two delivery tests. Each still sent its first message outside act() and waited with waitFor, whose polling uses the setTimeout that main's fake clock freezes, so both hung until the test timed out. The target-switch test also sent its message twice and looked for "Message delivery is unconfirmed.", a notice this branch replaced with "Sending…". Both now send inside act() as main's do, keep main's exact probe timing, and read this branch's notice. --- .../NativeChatStructuredSessionDelivery.test.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/renderer/src/components/native-chat/NativeChatStructuredSessionDelivery.test.tsx b/src/renderer/src/components/native-chat/NativeChatStructuredSessionDelivery.test.tsx index 642e5536fdb..1993c125179 100644 --- a/src/renderer/src/components/native-chat/NativeChatStructuredSessionDelivery.test.tsx +++ b/src/renderer/src/components/native-chat/NativeChatStructuredSessionDelivery.test.tsx @@ -424,8 +424,10 @@ describe('NativeChatStructuredSession delivery', () => { const send = mocks.composerProps?.structuredTransport?.send as | ((text: string, attachments: readonly { id: string; path: string }[]) => boolean) | undefined - expect(send?.('first', [])).toBe(true) - await waitFor(() => expect(mocks.call).toHaveBeenCalledOnce()) + await act(async () => { + expect(send?.('first', [])).toBe(true) + }) + expect(mocks.call).toHaveBeenCalledOnce() await act(async () => { expect(send?.('second', [])).toBe(true) @@ -435,7 +437,7 @@ describe('NativeChatStructuredSession delivery', () => { await advanceProbeClock(1) // The head is probed automatically, clears, and the queue drains. expect(mocks.call).toHaveBeenCalledTimes(3) - expect(screen.queryByText('Message delivery is unconfirmed.')).toBeNull() + expect(screen.queryByText('Sending…')).toBeNull() }, 20000) it('probes the same operation without marking an explicit user retry', async () => { @@ -609,14 +611,12 @@ describe('NativeChatStructuredSession delivery', () => { const send = mocks.composerProps?.structuredTransport?.send as | ((text: string, attachments: readonly { id: string; path: string }[]) => boolean) | undefined - expect(send?.('first', [])).toBe(true) - await waitFor(() => expect(mocks.call).toHaveBeenCalledOnce()) - await act(async () => { expect(send?.('first', [])).toBe(true) }) expect(mocks.call).toHaveBeenCalledOnce() - expect(screen.getByText('Message delivery is unconfirmed.')).toBeTruthy() + // No answer is no failure: the message reads as sending while Orca resends it. + expect(screen.getByText('Sending…')).toBeTruthy() await advanceProbeClock(300) rerender(makeView({ kind: 'environment', environmentId: 'env-1' }))