mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
fix tests, add golden command (#4486)
Co-authored-by: Jeremy Letto <jeremy.letto@datasite.com>
This commit is contained in:
parent
6ce346af4a
commit
6dc9f004ce
8 changed files with 481 additions and 272 deletions
|
|
@ -30,8 +30,8 @@ describe('KeepAliveService', () => {
|
|||
promise = new Promise(resolve => resolvePing = resolve);
|
||||
ping = (done) => promise.then(done);
|
||||
|
||||
checkReadyStateSpy = spyOn(socket, 'checkReadyState');
|
||||
checkReadyStateSpy.and.returnValue(true);
|
||||
checkReadyStateSpy = jest.spyOn(socket, 'checkReadyState');
|
||||
checkReadyStateSpy.mockImplementation(() => true);
|
||||
|
||||
service.startPingLoop(interval, ping);
|
||||
jest.advanceTimersByTime(interval);
|
||||
|
|
@ -52,15 +52,15 @@ describe('KeepAliveService', () => {
|
|||
});
|
||||
|
||||
it('should fire disconnected$ if lastPingPending is still true', () => {
|
||||
spyOn(service.disconnected$, 'next');
|
||||
jest.spyOn(service.disconnected$, 'next').mockImplementation(() => {});
|
||||
jest.advanceTimersByTime(interval);
|
||||
|
||||
expect(service.disconnected$.next).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should endPingLoop if socket is not open', () => {
|
||||
spyOn(service, 'endPingLoop');
|
||||
checkReadyStateSpy.and.returnValue(false);
|
||||
jest.spyOn(service, 'endPingLoop').mockImplementation(() => {});
|
||||
checkReadyStateSpy.mockImplementation(() => false);
|
||||
|
||||
resolvePing();
|
||||
jest.advanceTimersByTime(interval);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue