mirror of
https://github.com/stablyai/orca.git
synced 2026-10-08 08:02:32 +00:00
test(native-chat): the delivery tests send under main's fake clock and read C2's notices
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.
This commit is contained in:
+7
-7
@@ -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' }))
|
||||
|
||||
Reference in New Issue
Block a user