test leaving members disappear from memberlist
This commit is contained in:
@@ -59,6 +59,11 @@ module.exports = class RestMultiSession {
|
||||
this.log.done();
|
||||
return new RestMultiRoom(rooms, roomIdOrAlias, this.log);
|
||||
}
|
||||
|
||||
room(roomIdOrAlias) {
|
||||
const rooms = this.sessions.map(s => s.room(roomIdOrAlias));
|
||||
return new RestMultiRoom(rooms, roomIdOrAlias, this.log);
|
||||
}
|
||||
}
|
||||
|
||||
class RestMultiRoom {
|
||||
@@ -82,7 +87,7 @@ class RestMultiRoom {
|
||||
this.log.step(`leave ${this.roomIdOrAlias}`)
|
||||
await Promise.all(this.rooms.map(async (r) => {
|
||||
r.log.mute();
|
||||
await r.leave(message);
|
||||
await r.leave();
|
||||
r.log.unmute();
|
||||
}));
|
||||
this.log.done();
|
||||
|
||||
@@ -24,6 +24,7 @@ module.exports = class RestSession {
|
||||
this.log = new Logger(credentials.userId);
|
||||
this._credentials = credentials;
|
||||
this._displayName = null;
|
||||
this._rooms = {};
|
||||
}
|
||||
|
||||
userId() {
|
||||
@@ -51,7 +52,18 @@ module.exports = class RestSession {
|
||||
this.log.step(`joins ${roomIdOrAlias}`);
|
||||
const {room_id} = await this._post(`/join/${encodeURIComponent(roomIdOrAlias)}`);
|
||||
this.log.done();
|
||||
return new RestRoom(this, room_id, this.log);
|
||||
const room = new RestRoom(this, room_id, this.log);
|
||||
this._rooms[room_id] = room;
|
||||
this._rooms[roomIdOrAlias] = room;
|
||||
return room;
|
||||
}
|
||||
|
||||
room(roomIdOrAlias) {
|
||||
if (this._rooms.hasOwnProperty(roomIdOrAlias)) {
|
||||
return this._rooms[roomIdOrAlias];
|
||||
} else {
|
||||
throw new Error(`${this._credentials.userId} is not in ${roomIdOrAlias}`);
|
||||
}
|
||||
}
|
||||
|
||||
async createRoom(name, options) {
|
||||
|
||||
Reference in New Issue
Block a user