From 5fe386119087db97500eed5c379b80cb39b2a086 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 7 Aug 2018 17:23:01 +0200 Subject: [PATCH] create second user and join room first user creates --- start.js | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/start.js b/start.js index 9b0ed716e0..28eba781e5 100644 --- a/start.js +++ b/start.js @@ -27,6 +27,21 @@ const riotserver = 'http://localhost:5000'; let sessions = []; +async function createUser(username, options, riotserver) { + const session = await RiotSession.create(username, options, riotserver); + sessions.push(session); + + session.log.step("signs up"); + await signup(session, session.username, 'testtest'); + session.log.done(); + + const noticesName = "Server Notices"; + session.log.step(`accepts "${noticesName}" invite and accepting terms & conditions`); + await acceptServerNoticesInviteAndConsent(session, noticesName); + session.log.done(); + return session; +} + async function runTests() { console.log("running tests ..."); const options = {}; @@ -36,24 +51,21 @@ async function runTests() { options.executablePath = path; } - const alice = await RiotSession.create("alice", options, riotserver); - sessions.push(alice); - - alice.log.step("signs up"); - await signup(alice, alice.username, 'testtest'); - alice.log.done(); - - const noticesName = "Server Notices"; - alice.log.step(`accepts "${noticesName}" invite and accepting terms & conditions`); - await acceptServerNoticesInviteAndConsent(alice, noticesName); - alice.log.done(); + const alice = await createUser("alice", options, riotserver); + const bob = await createUser("bob", options, riotserver); const room = 'test'; alice.log.step(`creates room ${room}`); await createRoom(alice, room); alice.log.done(); + bob.log.step(`joins room ${room}`); + await createRoom(bob, room); + bob.log.done(); + + await alice.close(); + await bob.close(); } function onSuccess() {