attempted fix of a flaky ClientWebSocketAdapter test (#3114)

### Change Type

- [x] `tests` — Changes to any test code only
This commit is contained in:
Dan Groshev 2024-03-11 17:33:02 +00:00 committed by GitHub
parent 5e54526776
commit 19a1d01b8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -65,6 +65,9 @@ describe(ClientWebSocketAdapter, () => {
const prevServerSocket = connectedServerSocket
prevServerSocket.terminate()
await waitFor(() => connectedServerSocket !== prevServerSocket)
// there is a race here, the server could've opened a new socket already, but it hasn't
// transitioned to OPEN yet, thus the second waitFor
await waitFor(() => connectedServerSocket.readyState === WebSocket.OPEN)
expect(adapter._ws).not.toBe(prevClientSocket)
expect(adapter._ws?.readyState).toBe(WebSocket.OPEN)
})