mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-13 02:53:47 +00:00
Enabled @typescript-eslint/no-unsafe-call eslint rule again
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { EventSourcePolyfill as EventSource } from 'event-source-polyfill';
|
||||
import { EventSourcePolyfill } from 'event-source-polyfill';
|
||||
import { Mock } from 'ts-mockery';
|
||||
import { identity } from 'ramda';
|
||||
import { bindToMercureTopic } from '../../../src/mercure/helpers';
|
||||
@@ -22,7 +22,7 @@ describe('helpers', () => {
|
||||
])('does not bind an EventSource when loading, error or no hub URL', (mercureInfo) => {
|
||||
bindToMercureTopic(mercureInfo, [ '' ], identity, identity);
|
||||
|
||||
expect(EventSource).not.toHaveBeenCalled();
|
||||
expect(EventSourcePolyfill).not.toHaveBeenCalled();
|
||||
expect(onMessage).not.toHaveBeenCalled();
|
||||
expect(onTokenExpired).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -42,16 +42,16 @@ describe('helpers', () => {
|
||||
token,
|
||||
}, [ topic ], onMessage, onTokenExpired);
|
||||
|
||||
expect(EventSource).toHaveBeenCalledWith(hubUrl, {
|
||||
expect(EventSourcePolyfill).toHaveBeenCalledWith(hubUrl, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
|
||||
const [ es ] = EventSource.mock.instances;
|
||||
const [ es ] = (EventSourcePolyfill as any).mock.instances as EventSourcePolyfill[];
|
||||
|
||||
es.onmessage({ data: '{"foo": "bar"}' });
|
||||
es.onerror({ status: 401 });
|
||||
es.onmessage?.({ data: '{"foo": "bar"}' });
|
||||
es.onerror?.({ status: 401 });
|
||||
expect(onMessage).toHaveBeenCalledWith({ foo: 'bar' });
|
||||
expect(onTokenExpired).toHaveBeenCalled();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user