1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-09 10:22:46 +03:00

Add test for firing (pew pew) of events

This commit is contained in:
Kegan Dougal
2015-10-26 16:30:15 +00:00
parent be6d64fbfd
commit aa3e6514c6

View File

@@ -164,6 +164,36 @@ describe("MatrixClient syncing", function() {
});
});
it("should result in events on the room member firing", function(done) {
eventData.chunk = [
utils.mkPresence({
user: userC, presence: "online", name: "The Ghost"
}),
utils.mkMembership({
room: roomOne, mship: "invite", user: userC
})
];
httpBackend.when("GET", "/initialSync").respond(200, initialSync);
httpBackend.when("GET", "/events").respond(200, eventData);
var latestFiredName = null;
client.on("RoomMember.name", function(event, m) {
if (m.userId === userC && m.roomId === roomOne) {
latestFiredName = m.name;
}
});
client.startClient({
resolveInvitesToProfiles: true
});
httpBackend.flush().done(function() {
expect(latestFiredName).toEqual("The Ghost");
done();
});
});
it("should no-op if resolveInvitesToProfiles is not set", function(done) {
eventData.chunk = [
utils.mkMembership({