Merge pull request #2118 from matrix-org/bwindels/feature_lazyloading

Lazy loading of room members
This commit is contained in:
Bruno Windels 2018-08-16 18:14:55 +02:00 committed by GitHub
commit cead4096d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 191 additions and 137 deletions

View file

@ -14,21 +14,22 @@ import dis from '../../../../src/dispatcher';
import DMRoomMap from '../../../../src/utils/DMRoomMap.js';
import GroupStore from '../../../../src/stores/GroupStore.js';
import { Room, RoomMember } from 'matrix-js-sdk';
import { MatrixClient, Room, RoomMember } from 'matrix-js-sdk';
function generateRoomId() {
return '!' + Math.random().toString().slice(2, 10) + ':domain';
}
function createRoom(opts) {
const room = new Room(generateRoomId());
if (opts) {
Object.assign(room, opts);
}
return room;
}
describe('RoomList', () => {
function createRoom(opts) {
const room = new Room(generateRoomId(), null, client.getUserId());
if (opts) {
Object.assign(room, opts);
}
return room;
}
let parentDiv = null;
let sandbox = null;
let client = null;
@ -48,6 +49,8 @@ describe('RoomList', () => {
sandbox = TestUtils.stubClient(sandbox);
client = MatrixClientPeg.get();
client.credentials = {userId: myUserId};
//revert this to prototype method as the test-utils monkey-patches this to return a hardcoded value
client.getUserId = MatrixClient.prototype.getUserId;
clock = lolex.install();