Skip to content

Commit b0753ad

Browse files
committed
test(copilot): assert throttle follow-through after an in-flight merge clears
1 parent 46212f3 commit b0753ad

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

apps/sim/lib/copilot/request/go/file-preview-adapter.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,5 +205,14 @@ describe('processFilePreviewStreamEvent — live-doc streaming merge', () => {
205205
await flushMicrotasks()
206206

207207
expect(mergeEditIntoLiveFileDocMock).not.toHaveBeenCalled()
208+
209+
// The dropped in-flight tick must NOT advance the throttle window, so once the in-flight merge
210+
// clears the very next delta merges immediately — no wait for a fresh throttle interval.
211+
isLiveDocMergeInFlightMock.mockReturnValue(false)
212+
await drive(editContentDelta(' world'), intent)
213+
await flushMicrotasks()
214+
215+
expect(mergeEditIntoLiveFileDocMock).toHaveBeenCalledTimes(1)
216+
expect(mergeEditIntoLiveFileDocMock.mock.calls[0][0]).toBe('file-busy')
208217
})
209218
})

0 commit comments

Comments
 (0)