diff --git a/lib/store/stub.js b/lib/store/stub.js index 1c835eca9..4cdc1a93e 100644 --- a/lib/store/stub.js +++ b/lib/store/stub.js @@ -122,6 +122,15 @@ StubStore.prototype = { */ getFilterIdByName: function(filterName) { return null; + }, + + /** + * Set a filter name to ID mapping. + * @param {string} filterName + * @param {string} filterId + */ + setFilterIdByName: function(filterName, filterId) { + } // TODO diff --git a/lib/sync.js b/lib/sync.js index da0f1f4c1..52371fc7c 100644 --- a/lib/sync.js +++ b/lib/sync.js @@ -299,6 +299,8 @@ SyncApi.prototype._sync = function(syncOptions, attempt) { } stateEvents.forEach(function(e) { client.emit("event", e); }); timelineEvents.forEach(function(e) { client.emit("event", e); }); + ephemeralEvents.forEach(function(e) { client.emit("event", e); }); + accountDataEvents.forEach(function(e) { client.emit("event", e); }); }); // Ignore leave rooms for now (TODO: Honour includeArchived opt) diff --git a/spec/integ/matrix-client-event-emitter.spec.js b/spec/integ/matrix-client-event-emitter.spec.js index a6c04f36f..e249ce149 100644 --- a/spec/integ/matrix-client-event-emitter.spec.js +++ b/spec/integ/matrix-client-event-emitter.spec.js @@ -19,6 +19,7 @@ describe("MatrixClient events", function() { accessToken: selfAccessToken }); httpBackend.when("GET", "/pushrules").respond(200, {}); + httpBackend.when("POST", "/filter").respond(200, { filter_id: "a filter id" }); }); afterEach(function() { @@ -26,108 +27,113 @@ describe("MatrixClient events", function() { }); describe("emissions", function() { - var initialSync = { - end: "s_5_3", - presence: [{ - event_id: "$wefiuewh:bar", - type: "m.presence", - content: { - user_id: "@foo:bar", - displayname: "Foo Bar", - presence: "online" - } - }], - rooms: [{ - room_id: "!erufh:bar", - membership: "join", - messages: { - start: "s", - end: "t", - chunk: [ - utils.mkMessage({ - room: "!erufh:bar", user: "@foo:bar", msg: "hmmm" - }) - ] - }, - state: [ - utils.mkMembership({ - room: "!erufh:bar", mship: "join", user: "@foo:bar" - }), - utils.mkEvent({ - type: "m.room.create", room: "!erufh:bar", user: "@foo:bar", - content: { - creator: "@foo:bar" - } + var SYNC_DATA = { + next_batch: "s_5_3", + presence: { + events: [ + utils.mkPresence({ + user: "@foo:bar", name: "Foo Bar", presence: "online" }) ] - }] - }; - var eventData = { - start: "s_5_3", - end: "e_6_7", - chunk: [ - utils.mkMessage({ - room: "!erufh:bar", user: "@foo:bar", msg: "ello ello" - }), - utils.mkMessage({ - room: "!erufh:bar", user: "@foo:bar", msg: ":D" - }), - utils.mkEvent({ - type: "m.typing", room: "!erufh:bar", content: { - user_ids: ["@foo:bar"] + }, + rooms: { + join: { + "!erufh:bar": { + timeline: { + events: [ + utils.mkMessage({ + room: "!erufh:bar", user: "@foo:bar", msg: "hmmm" + }) + ], + prev_batch: "s" + }, + state: { + events: [ + utils.mkMembership({ + room: "!erufh:bar", mship: "join", user: "@foo:bar" + }), + utils.mkEvent({ + type: "m.room.create", room: "!erufh:bar", user: "@foo:bar", + content: { + creator: "@foo:bar" + } + }) + ] + } } - }) - ] + } + } + }; + var NEXT_SYNC_DATA = { + next_batch: "e_6_7", + rooms: { + join: { + "!erufh:bar": { + timeline: { + events: [ + utils.mkMessage({ + room: "!erufh:bar", user: "@foo:bar", msg: "ello ello" + }), + utils.mkMessage({ + room: "!erufh:bar", user: "@foo:bar", msg: ":D" + }), + ] + }, + ephemeral: { + events: [ + utils.mkEvent({ + type: "m.typing", room: "!erufh:bar", content: { + user_ids: ["@foo:bar"] + } + }) + ] + } + } + } + } }; - it("should emit events from both /initialSync and /events", function(done) { - httpBackend.when("GET", "/initialSync").respond(200, initialSync); - httpBackend.when("GET", "/events").respond(200, eventData); + it("should emit events from both the first and subsequent /sync calls", + function(done) { + httpBackend.when("GET", "/sync").respond(200, SYNC_DATA); + httpBackend.when("GET", "/sync").respond(200, NEXT_SYNC_DATA); + + var expectedEvents = []; + expectedEvents = expectedEvents.concat( + SYNC_DATA.presence.events, + SYNC_DATA.rooms.join["!erufh:bar"].timeline.events, + SYNC_DATA.rooms.join["!erufh:bar"].state.events, + NEXT_SYNC_DATA.rooms.join["!erufh:bar"].timeline.events, + NEXT_SYNC_DATA.rooms.join["!erufh:bar"].ephemeral.events + ); + - // initial sync events are unordered, so make an array of the types - // that should be emitted and we'll just pick them off one by one, - // so long as this is emptied we're good. - var initialSyncEventTypes = [ - "m.presence", "m.room.member", "m.room.message", "m.room.create" - ]; var chunkIndex = 0; client.on("event", function(event) { - if (initialSyncEventTypes.length === 0) { - if (chunkIndex + 1 >= eventData.chunk.length) { - return; + var found = false; + for (var i = 0; i < expectedEvents.length; i++) { + if (expectedEvents[i].event_id === event.getId()) { + expectedEvents.splice(i, 1); + found = true; + break; } - // this should be /events now - expect(eventData.chunk[chunkIndex].event_id).toEqual( - event.getId() - ); - chunkIndex++; - return; - } - var index = initialSyncEventTypes.indexOf(event.getType()); - expect(index).not.toEqual( - -1, "Unexpected event type: " + event.getType() - ); - if (index >= 0) { - initialSyncEventTypes.splice(index, 1); } + expect(found).toBe(true, "Unexpected 'event' emitted: " + event.getType()); }); client.startClient(); httpBackend.flush().done(function() { - expect(initialSyncEventTypes.length).toEqual( - 0, "Failed to see all events from /initialSync" - ); - expect(chunkIndex + 1).toEqual( - eventData.chunk.length, "Failed to see all events from /events" + expect(expectedEvents.length).toEqual( + 0, "Failed to see all events from /sync calls" ); done(); }); }); it("should emit User events", function(done) { - httpBackend.when("GET", "/initialSync").respond(200, initialSync); - httpBackend.when("GET", "/events").respond(200, eventData); + httpBackend.when("GET", "/sync").respond(200, SYNC_DATA); + httpBackend.when("GET", "/sync").respond(200, NEXT_SYNC_DATA); var fired = false; client.on("User.presence", function(event, user) { fired = true; @@ -135,9 +141,9 @@ describe("MatrixClient events", function() { expect(event).toBeDefined(); if (!user || !event) { return; } - expect(event.event).toEqual(initialSync.presence[0]); + expect(event.event).toEqual(SYNC_DATA.presence.events[0]); expect(user.presence).toEqual( - initialSync.presence[0].content.presence + SYNC_DATA.presence.events[0].content.presence ); }); client.startClient(); @@ -149,8 +155,8 @@ describe("MatrixClient events", function() { }); it("should emit Room events", function(done) { - httpBackend.when("GET", "/initialSync").respond(200, initialSync); - httpBackend.when("GET", "/events").respond(200, eventData); + httpBackend.when("GET", "/sync").respond(200, SYNC_DATA); + httpBackend.when("GET", "/sync").respond(200, NEXT_SYNC_DATA); var roomInvokeCount = 0; var roomNameInvokeCount = 0; var timelineFireCount = 0; @@ -183,8 +189,8 @@ describe("MatrixClient events", function() { }); it("should emit RoomState events", function(done) { - httpBackend.when("GET", "/initialSync").respond(200, initialSync); - httpBackend.when("GET", "/events").respond(200, eventData); + httpBackend.when("GET", "/sync").respond(200, SYNC_DATA); + httpBackend.when("GET", "/sync").respond(200, NEXT_SYNC_DATA); var roomStateEventTypes = [ "m.room.member", "m.room.create" @@ -232,8 +238,8 @@ describe("MatrixClient events", function() { }); it("should emit RoomMember events", function(done) { - httpBackend.when("GET", "/initialSync").respond(200, initialSync); - httpBackend.when("GET", "/events").respond(200, eventData); + httpBackend.when("GET", "/sync").respond(200, SYNC_DATA); + httpBackend.when("GET", "/sync").respond(200, NEXT_SYNC_DATA); var typingInvokeCount = 0; var powerLevelInvokeCount = 0; diff --git a/spec/integ/matrix-client-opts.spec.js b/spec/integ/matrix-client-opts.spec.js index d8c010c78..347e3acd3 100644 --- a/spec/integ/matrix-client-opts.spec.js +++ b/spec/integ/matrix-client-opts.spec.js @@ -11,47 +11,45 @@ describe("MatrixClient opts", function() { var userB = "@bob:localhost"; var accessToken = "aseukfgwef"; var roomId = "!foo:bar"; - var eventData = { - chunk: [], - start: "s", - end: "e" - }; - var initialSync = { - end: "s_5_3", - presence: [], - rooms: [{ - membership: "join", - room_id: roomId, - messages: { - start: "f_1_1", - end: "f_2_2", - chunk: [ - utils.mkMessage({ - room: roomId, user: userB, msg: "hello" - }) - ] - }, - state: [ - utils.mkEvent({ - type: "m.room.name", room: roomId, user: userB, - content: { - name: "Old room name" + var syncData = { + next_batch: "s_5_3", + presence: {}, + rooms: { + join: { + "!foo:bar": { // roomId + timeline: { + events: [ + utils.mkMessage({ + room: roomId, user: userB, msg: "hello" + }) + ], + prev_batch: "f_1_1" + }, + state: { + events: [ + utils.mkEvent({ + type: "m.room.name", room: roomId, user: userB, + content: { + name: "Old room name" + } + }), + utils.mkMembership({ + room: roomId, mship: "join", user: userB, name: "Bob" + }), + utils.mkMembership({ + room: roomId, mship: "join", user: userId, name: "Alice" + }), + utils.mkEvent({ + type: "m.room.create", room: roomId, user: userId, + content: { + creator: userId + } + }) + ] } - }), - utils.mkMembership({ - room: roomId, mship: "join", user: userB, name: "Bob" - }), - utils.mkMembership({ - room: roomId, mship: "join", user: userId, name: "Alice" - }), - utils.mkEvent({ - type: "m.room.create", room: roomId, user: userId, - content: { - creator: userId - } - }) - ] - }] + } + } + } }; beforeEach(function() { @@ -101,13 +99,13 @@ describe("MatrixClient opts", function() { ); }); httpBackend.when("GET", "/pushrules").respond(200, {}); - httpBackend.when("GET", "/initialSync").respond(200, initialSync); - httpBackend.when("GET", "/events").respond(200, eventData); + httpBackend.when("POST", "/filter").respond(200, { filter_id: "foo" }); + httpBackend.when("GET", "/sync").respond(200, syncData); client.startClient(); httpBackend.flush("/pushrules", 1).then(function() { - return httpBackend.flush("/initialSync", 1); + return httpBackend.flush("/filter", 1); }).then(function() { - return httpBackend.flush("/events", 1); + return httpBackend.flush("/sync", 1); }).done(function() { expect(expectedEventTypes.length).toEqual( 0, "Expected to see event types: " + expectedEventTypes diff --git a/spec/integ/matrix-client-room-timeline.spec.js b/spec/integ/matrix-client-room-timeline.spec.js index 58d32c011..59a45704c 100644 --- a/spec/integ/matrix-client-room-timeline.spec.js +++ b/spec/integ/matrix-client-room-timeline.spec.js @@ -12,45 +12,93 @@ describe("MatrixClient room timelines", function() { var accessToken = "aseukfgwef"; var roomId = "!foo:bar"; var otherUserId = "@bob:localhost"; - var eventData; - var initialSync = { - end: "s_5_3", - presence: [], - rooms: [{ - membership: "join", - room_id: roomId, - messages: { - start: "f_1_1", - end: "f_2_2", - chunk: [ - utils.mkMessage({ - room: roomId, user: otherUserId, msg: "hello" - }) - ] - }, - state: [ - utils.mkEvent({ - type: "m.room.name", room: roomId, user: otherUserId, - content: { - name: "Old room name" + var USER_MEMBERSHIP_EVENT = utils.mkMembership({ + room: roomId, mship: "join", user: userId, name: userName + }); + var ROOM_NAME_EVENT = utils.mkEvent({ + type: "m.room.name", room: roomId, user: otherUserId, + content: { + name: "Old room name" + } + }); + var NEXT_SYNC_DATA; + var SYNC_DATA = { + next_batch: "s_5_3", + rooms: { + join: { + "!foo:bar": { // roomId + timeline: { + events: [ + utils.mkMessage({ + room: roomId, user: otherUserId, msg: "hello" + }) + ], + prev_batch: "f_1_1" + }, + state: { + events: [ + ROOM_NAME_EVENT, + utils.mkMembership({ + room: roomId, mship: "join", user: otherUserId, name: "Bob" + }), + USER_MEMBERSHIP_EVENT, + utils.mkEvent({ + type: "m.room.create", room: roomId, user: userId, + content: { + creator: userId + } + }) + ] } - }), - utils.mkMembership({ - room: roomId, mship: "join", user: otherUserId, name: "Bob" - }), - utils.mkMembership({ - room: roomId, mship: "join", user: userId, name: userName - }), - utils.mkEvent({ - type: "m.room.create", room: roomId, user: userId, - content: { - creator: userId - } - }) - ] - }] + } + } + } }; + function setNextSyncData(events) { + events = events || []; + NEXT_SYNC_DATA = { + next_batch: "n", + presence: { events: [] }, + rooms: { + invite: {}, + join: { + "!foo:bar": { + timeline: { events: [] }, + state: { events: [] }, + ephemeral: { events: [] } + } + }, + leave: {} + } + }; + events.forEach(function(e) { + if (e.room_id !== roomId) { + throw new Error("setNextSyncData only works with one room id"); + } + if (e.state_key) { + if (e.__prev_event === undefined) { + throw new Error( + "setNextSyncData needs the prev state set to '__prev_event' " + + "for " + e.type + ); + } + if (e.__prev_event !== null) { + // push the previous state for this event type + NEXT_SYNC_DATA.rooms.join[roomId].state.events.push(e.__prev_event); + } + // push the current + NEXT_SYNC_DATA.rooms.join[roomId].timeline.events.push(e); + } + else if (["m.typing", "m.receipt"].indexOf(e.type) !== -1) { + NEXT_SYNC_DATA.rooms.join[roomId].ephemeral.events.push(e); + } + else { + NEXT_SYNC_DATA.rooms.join[roomId].timeline.events.push(e); + } + }); + } + beforeEach(function(done) { utils.beforeEach(this); httpBackend = new HttpBackend(); @@ -60,18 +108,20 @@ describe("MatrixClient room timelines", function() { userId: userId, accessToken: accessToken }); - eventData = { - chunk: [], - end: "end_", - start: "start_" - }; + setNextSyncData(); httpBackend.when("GET", "/pushrules").respond(200, {}); - httpBackend.when("GET", "/initialSync").respond(200, initialSync); - httpBackend.when("GET", "/events").respond(200, function() { - return eventData; + httpBackend.when("POST", "/filter").respond(200, { filter_id: "fid" }); + httpBackend.when("GET", "/sync").respond(200, SYNC_DATA); + httpBackend.when("GET", "/sync").respond(200, function() { + return NEXT_SYNC_DATA; }); client.startClient(); - httpBackend.flush("/pushrules").done(done); + httpBackend.flush("/pushrules").then(function() { + console.log("Flushed push"); + return httpBackend.flush("/filter"); + }).done(function () { + console.log("ALL READY"); done(); + }); }); afterEach(function() { @@ -97,11 +147,11 @@ describe("MatrixClient room timelines", function() { expect(member.userId).toEqual(userId); expect(member.name).toEqual(userName); - httpBackend.flush("/events", 1).done(function() { + httpBackend.flush("/sync", 1).done(function() { done(); }); }); - httpBackend.flush("/initialSync", 1); + httpBackend.flush("/sync", 1); }); it("should be updated correctly when the send request finishes " + @@ -110,12 +160,12 @@ describe("MatrixClient room timelines", function() { httpBackend.when("PUT", "/txn1").respond(200, { event_id: eventId }); - eventData.chunk = [ - utils.mkMessage({ - body: "I am a fish", user: userId, room: roomId - }) - ]; - eventData.chunk[0].event_id = eventId; + + var ev = utils.mkMessage({ + body: "I am a fish", user: userId, room: roomId + }) + ev.event_id = eventId; + setNextSyncData([ev]); client.on("sync", function(state) { if (state !== "PREPARED") { return; } @@ -123,14 +173,14 @@ describe("MatrixClient room timelines", function() { client.sendTextMessage(roomId, "I am a fish", "txn1").done( function() { expect(room.timeline[1].getId()).toEqual(eventId); - httpBackend.flush("/events", 1).done(function() { + httpBackend.flush("/sync", 1).done(function() { expect(room.timeline[1].getId()).toEqual(eventId); done(); }); }); httpBackend.flush("/txn1", 1); }); - httpBackend.flush("/initialSync", 1); + httpBackend.flush("/sync", 1); }); it("should be updated correctly when the send request finishes " + @@ -139,18 +189,18 @@ describe("MatrixClient room timelines", function() { httpBackend.when("PUT", "/txn1").respond(200, { event_id: eventId }); - eventData.chunk = [ - utils.mkMessage({ - body: "I am a fish", user: userId, room: roomId - }) - ]; - eventData.chunk[0].event_id = eventId; + + var ev = utils.mkMessage({ + body: "I am a fish", user: userId, room: roomId + }) + ev.event_id = eventId; + setNextSyncData([ev]); client.on("sync", function(state) { if (state !== "PREPARED") { return; } var room = client.getRoom(roomId); var promise = client.sendTextMessage(roomId, "I am a fish", "txn1"); - httpBackend.flush("/events", 1).done(function() { + httpBackend.flush("/sync", 1).done(function() { // expect 3rd msg, it doesn't know this is the request is just did expect(room.timeline.length).toEqual(3); httpBackend.flush("/txn1", 1); @@ -162,7 +212,7 @@ describe("MatrixClient room timelines", function() { }); }); - httpBackend.flush("/initialSync", 1); + httpBackend.flush("/sync", 1); }); }); @@ -195,9 +245,9 @@ describe("MatrixClient room timelines", function() { }); httpBackend.flush("/messages", 1); - httpBackend.flush("/events", 1); + httpBackend.flush("/sync", 1); }); - httpBackend.flush("/initialSync", 1); + httpBackend.flush("/sync", 1); }); it("should set the right event.sender values", function(done) { @@ -238,9 +288,9 @@ describe("MatrixClient room timelines", function() { }); httpBackend.flush("/messages", 1); - httpBackend.flush("/events", 1); + httpBackend.flush("/sync", 1); }); - httpBackend.flush("/initialSync", 1); + httpBackend.flush("/sync", 1); }); it("should add it them to the right place in the timeline", function(done) { @@ -267,9 +317,9 @@ describe("MatrixClient room timelines", function() { }); httpBackend.flush("/messages", 1); - httpBackend.flush("/events", 1); + httpBackend.flush("/sync", 1); }); - httpBackend.flush("/initialSync", 1); + httpBackend.flush("/sync", 1); }); it("should use 'end' as the next pagination token", function(done) { @@ -289,21 +339,23 @@ describe("MatrixClient room timelines", function() { expect(room.oldState.paginationToken).toEqual(sbEndTok); }); - httpBackend.flush("/events", 1); + httpBackend.flush("/sync", 1); httpBackend.flush("/messages", 1).done(function() { done(); }); }); - httpBackend.flush("/initialSync", 1); + httpBackend.flush("/sync", 1); }); }); describe("new events", function() { it("should be added to the right place in the timeline", function(done) { - eventData.chunk = [ + var eventData = [ utils.mkMessage({user: userId, room: roomId}), utils.mkMessage({user: userId, room: roomId}) ]; + setNextSyncData(eventData); + client.on("sync", function(state) { if (state !== "PREPARED") { return; } var room = client.getRoom(roomId); @@ -312,37 +364,40 @@ describe("MatrixClient room timelines", function() { client.on("Room.timeline", function(event, rm, toStart) { expect(toStart).toBe(false); expect(rm).toEqual(room); - expect(event.event).toEqual(eventData.chunk[index]); + expect(event.event).toEqual(eventData[index]); index += 1; }); httpBackend.flush("/messages", 1); - httpBackend.flush("/events", 1).done(function() { + httpBackend.flush("/sync", 1).done(function() { expect(index).toEqual(2); expect(room.timeline[room.timeline.length - 1].event).toEqual( - eventData.chunk[1] + eventData[1] ); expect(room.timeline[room.timeline.length - 2].event).toEqual( - eventData.chunk[0] + eventData[0] ); done(); }); }); - httpBackend.flush("/initialSync", 1); + httpBackend.flush("/sync", 1); }); it("should set the right event.sender values", function(done) { - eventData.chunk = [ + var eventData = [ utils.mkMessage({user: userId, room: roomId}), utils.mkMembership({ user: userId, room: roomId, mship: "join", name: "New Name" }), utils.mkMessage({user: userId, room: roomId}) ]; + eventData[1].__prev_event = USER_MEMBERSHIP_EVENT; + setNextSyncData(eventData); + client.on("sync", function(state) { if (state !== "PREPARED") { return; } var room = client.getRoom(roomId); - httpBackend.flush("/events", 1).done(function() { + httpBackend.flush("/sync", 1).done(function() { var preNameEvent = room.timeline[room.timeline.length - 3]; var postNameEvent = room.timeline[room.timeline.length - 1]; expect(preNameEvent.sender.name).toEqual(userName); @@ -350,17 +405,18 @@ describe("MatrixClient room timelines", function() { done(); }); }); - httpBackend.flush("/initialSync", 1); + httpBackend.flush("/sync", 1); }); it("should set the right room.name", function(done) { - eventData.chunk = [ - utils.mkEvent({ - user: userId, room: roomId, type: "m.room.name", content: { - name: "Room 2" - } - }) - ]; + var secondRoomNameEvent = utils.mkEvent({ + user: userId, room: roomId, type: "m.room.name", content: { + name: "Room 2" + } + }); + secondRoomNameEvent.__prev_event = ROOM_NAME_EVENT; + setNextSyncData([secondRoomNameEvent]); + client.on("sync", function(state) { if (state !== "PREPARED") { return; } var room = client.getRoom(roomId); @@ -369,32 +425,32 @@ describe("MatrixClient room timelines", function() { nameEmitCount += 1; }); - httpBackend.flush("/events", 1).done(function() { + httpBackend.flush("/sync", 1).done(function() { expect(nameEmitCount).toEqual(1); expect(room.name).toEqual("Room 2"); // do another round - eventData.chunk = [ - utils.mkEvent({ - user: userId, room: roomId, type: "m.room.name", content: { - name: "Room 3" - } - }) - ]; - httpBackend.when("GET", "/events").respond(200, eventData); - httpBackend.flush("/events", 1).done(function() { + var thirdRoomNameEvent = utils.mkEvent({ + user: userId, room: roomId, type: "m.room.name", content: { + name: "Room 3" + } + }); + thirdRoomNameEvent.__prev_event = secondRoomNameEvent; + setNextSyncData([thirdRoomNameEvent]); + httpBackend.when("GET", "/sync").respond(200, NEXT_SYNC_DATA); + httpBackend.flush("/sync", 1).done(function() { expect(nameEmitCount).toEqual(2); expect(room.name).toEqual("Room 3"); done(); }); }); }); - httpBackend.flush("/initialSync", 1); + httpBackend.flush("/sync", 1); }); it("should set the right room members", function(done) { var userC = "@cee:bar"; var userD = "@dee:bar"; - eventData.chunk = [ + var eventData = [ utils.mkMembership({ user: userC, room: roomId, mship: "join", name: "C" }), @@ -402,10 +458,14 @@ describe("MatrixClient room timelines", function() { user: userC, room: roomId, mship: "invite", skey: userD }) ]; + eventData[0].__prev_event = null; + eventData[1].__prev_event = null; + setNextSyncData(eventData); + client.on("sync", function(state) { if (state !== "PREPARED") { return; } var room = client.getRoom(roomId); - httpBackend.flush("/events", 1).done(function() { + httpBackend.flush("/sync", 1).done(function() { expect(room.currentState.getMembers().length).toEqual(4); expect(room.currentState.getMember(userC).name).toEqual("C"); expect(room.currentState.getMember(userC).membership).toEqual( @@ -418,7 +478,7 @@ describe("MatrixClient room timelines", function() { done(); }); }); - httpBackend.flush("/initialSync", 1); + httpBackend.flush("/sync", 1); }); }); });