untangle updateStatus (#5018)

* untangle updateStatus

* fix test
This commit is contained in:
Jeremy Letto 2024-04-04 23:56:12 -05:00 committed by GitHub
parent be5d42baba
commit 2f6c018b7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 32 deletions

View file

@ -1,17 +1,14 @@
import { KeepAliveService } from './KeepAliveService';
import { WebSocketService } from './WebSocketService';
import webClient from '../WebClient';
describe('KeepAliveService', () => {
let service: KeepAliveService;
let socket: WebSocketService;
beforeEach(() => {
jest.useFakeTimers();
socket = new WebSocketService(webClient);
service = new KeepAliveService(socket);
service = new KeepAliveService(webClient.socket);
});
it('should create', () => {
@ -30,7 +27,7 @@ describe('KeepAliveService', () => {
promise = new Promise(resolve => resolvePing = resolve);
ping = (done) => promise.then(done);
checkReadyStateSpy = jest.spyOn(socket, 'checkReadyState');
checkReadyStateSpy = jest.spyOn(webClient.socket, 'checkReadyState');
checkReadyStateSpy.mockImplementation(() => true);
service.startPingLoop(interval, ping);