diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-11-17 10:21:51 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-11-17 10:21:51 +0000 |
commit | 1d3ef8734cea9a1ce8befdf27db297ca70cfeee3 (patch) | |
tree | 12c7ac945749c68b81e3ae55c39dfd58ae824bf0 /syweb/webclient/test | |
parent | Merge PDUs and Events into one object (diff) | |
parent | Move getLastMessage to modelService. (diff) | |
download | synapse-1d3ef8734cea9a1ce8befdf27db297ca70cfeee3.tar.xz |
Merge remote-tracking branch 'origin/develop' into merge_pdu_event_objects
Diffstat (limited to 'syweb/webclient/test')
-rw-r--r-- | syweb/webclient/test/unit/event-handler-service.spec.js | 42 | ||||
-rw-r--r-- | syweb/webclient/test/unit/model-service.spec.js | 34 | ||||
-rw-r--r-- | syweb/webclient/test/unit/register-controller.spec.js | 2 |
3 files changed, 36 insertions, 42 deletions
diff --git a/syweb/webclient/test/unit/event-handler-service.spec.js b/syweb/webclient/test/unit/event-handler-service.spec.js index c17cdb8715..5eb6fe10ab 100644 --- a/syweb/webclient/test/unit/event-handler-service.spec.js +++ b/syweb/webclient/test/unit/event-handler-service.spec.js @@ -26,45 +26,5 @@ describe('EventHandlerService', function() { scope = $rootScope; })); - it('should be able to get the number of joined users in a room', inject( - function(eventHandlerService) { - var roomId = "!foo:matrix.org"; - // set mocked data - modelService.getRoom = function(roomId) { - return { - room_id: roomId, - current_room_state: { - members: { - "@adam:matrix.org": { - event: { - content: { membership: "join" }, - user_id: "@adam:matrix.org" - } - }, - "@beth:matrix.org": { - event: { - content: { membership: "invite" }, - user_id: "@beth:matrix.org" - } - }, - "@charlie:matrix.org": { - event: { - content: { membership: "join" }, - user_id: "@charlie:matrix.org" - } - }, - "@danice:matrix.org": { - event: { - content: { membership: "leave" }, - user_id: "@danice:matrix.org" - } - } - } - } - }; - } - - var num = eventHandlerService.getUsersCountInRoom(roomId); - expect(num).toEqual(2); - })); + }); diff --git a/syweb/webclient/test/unit/model-service.spec.js b/syweb/webclient/test/unit/model-service.spec.js index 4639a6984c..d92930e2e0 100644 --- a/syweb/webclient/test/unit/model-service.spec.js +++ b/syweb/webclient/test/unit/model-service.spec.js @@ -193,4 +193,38 @@ describe('ModelService', function() { })); + + it('should be able to get the number of joined users in a room', inject( + function(modelService) { + var roomId = "!foo:matrix.org"; + // set mocked data + var room = modelService.getRoom(roomId); + room.current_room_state.storeStateEvent({ + content: { membership: "join" }, + user_id: "@adam:matrix.org", + state_key: "@adam:matrix.org", + type: "m.room.member" + }); + room.current_room_state.storeStateEvent({ + content: { membership: "invite" }, + user_id: "@adam:matrix.org", + state_key: "@beth:matrix.org", + type: "m.room.member" + }); + room.current_room_state.storeStateEvent({ + content: { membership: "join" }, + user_id: "@charlie:matrix.org", + state_key: "@charlie:matrix.org", + type: "m.room.member" + }); + room.current_room_state.storeStateEvent({ + content: { membership: "leave" }, + user_id: "@danice:matrix.org", + state_key: "@danice:matrix.org", + type: "m.room.member" + }); + + var num = modelService.getUserCountInRoom(roomId); + expect(num).toEqual(2); + })); }); diff --git a/syweb/webclient/test/unit/register-controller.spec.js b/syweb/webclient/test/unit/register-controller.spec.js index b5c7842358..62d7a4aa32 100644 --- a/syweb/webclient/test/unit/register-controller.spec.js +++ b/syweb/webclient/test/unit/register-controller.spec.js @@ -5,7 +5,7 @@ describe("RegisterController ", function() { var avatarUrl = "avatar.url"; window.webClientConfig = { - useCapatcha: false + useCaptcha: false }; // test vars |