add closeCode test in socket adapter

pull/3551/head
Mime Čuvalo 2024-04-23 09:55:21 +01:00
rodzic c481fffdb5
commit 0342ae76a2
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: BA84499022AC984D
1 zmienionych plików z 10 dodań i 0 usunięć

Wyświetl plik

@ -174,6 +174,16 @@ describe(ClientWebSocketAdapter, () => {
expect(onStatusChange).toHaveBeenCalledWith('error', undefined)
})
it('signals the correct closeCode when a room is not found', async () => {
const onStatusChange = jest.fn()
adapter.onStatusChange(onStatusChange)
await waitFor(() => adapter._ws?.readyState === WebSocket.OPEN)
adapter._ws!.onclose?.({ code: 4099 } as any)
expect(onStatusChange).toHaveBeenCalledWith('error', 4099)
})
it('signals status changes while restarting', async () => {
const onStatusChange = jest.fn()
await waitFor(() => adapter._ws?.readyState === WebSocket.OPEN)