|
@@ -122,8 +122,14 @@ describe('subscribe', () => {
|
|
|
expect(onMessage).toHaveBeenCalledWith(1)
|
|
expect(onMessage).toHaveBeenCalledWith(1)
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
// @ts-ignore
|
|
|
- dummyEventSource.onerror()
|
|
|
|
|
- expect(console.error).toHaveBeenCalledWith('SSE - An error happened')
|
|
|
|
|
|
|
+ const event = { target: { readyState: EventSourcePolyfill.CLOSED } }
|
|
|
|
|
+ dummyEventSource.close = vi.fn()
|
|
|
|
|
+
|
|
|
|
|
+ // @ts-ignore
|
|
|
|
|
+ dummyEventSource.onerror(event)
|
|
|
|
|
+ expect(console.log).toHaveBeenCalledWith('SSE closed')
|
|
|
|
|
+
|
|
|
|
|
+ expect(dummyEventSource.close).toHaveBeenCalled()
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|