test: improve app 'session-created' event spec (#25799)

This commit is contained in:
Milan Burda 2020-10-07 15:59:27 +02:00 committed by GitHub
parent a5ca25ba65
commit 65089a69a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -979,10 +979,10 @@ describe('session module', () => {
describe('session-created event', () => {
it('is emitted when a session is created', async () => {
const eventEmitted = new Promise<Session>(resolve => app.once('session-created', resolve));
session.fromPartition('' + Math.random());
const s = await eventEmitted;
expect(s.constructor.name).to.equal('Session');
const sessionCreated = emittedOnce(app, 'session-created');
const session1 = session.fromPartition('' + Math.random());
const [session2] = await sessionCreated;
expect(session1).to.equal(session2);
});
});
});