mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-04 16:54:11 -04:00
fix(communication): send ready event when both sides are ready
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
e6b9afc686
commit
f4a1999a8b
11 changed files with 271 additions and 142 deletions
|
@ -8,7 +8,6 @@ import {
|
|||
MessageTransporter,
|
||||
MessageType,
|
||||
MockedBackendTransportAdapter,
|
||||
waitForOtherPromisesToFinish,
|
||||
} from '@hedgedoc/commons';
|
||||
|
||||
import { RealtimeUserStatusAdapter } from './realtime-user-status-adapter';
|
||||
|
@ -41,6 +40,14 @@ describe('realtime user status adapter', () => {
|
|||
let messageTransporterNotReady: MessageTransporter;
|
||||
let messageTransporterDecline: MessageTransporter;
|
||||
|
||||
beforeAll(() => {
|
||||
jest.useFakeTimers();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
clientLoggedIn1 = undefined;
|
||||
clientLoggedIn2 = undefined;
|
||||
|
@ -139,11 +146,12 @@ describe('realtime user status adapter', () => {
|
|||
'sendMessage',
|
||||
);
|
||||
|
||||
messageTransporterLoggedIn1.sendReady();
|
||||
messageTransporterLoggedIn2.sendReady();
|
||||
messageTransporterGuest.sendReady();
|
||||
messageTransporterDecline.sendReady();
|
||||
await waitForOtherPromisesToFinish();
|
||||
messageTransporterLoggedIn1.startSendingOfReadyRequests();
|
||||
messageTransporterLoggedIn2.startSendingOfReadyRequests();
|
||||
messageTransporterGuest.startSendingOfReadyRequests();
|
||||
messageTransporterDecline.startSendingOfReadyRequests();
|
||||
|
||||
jest.advanceTimersByTime(500);
|
||||
});
|
||||
|
||||
it('can answer a state request', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue