summary refs log tree commit diff
path: root/syweb/webclient/test
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-11-06 14:52:22 +0000
committerKegan Dougal <kegan@matrix.org>2014-11-06 14:52:22 +0000
commite3c3f5a6d04bfbc0256010e9fb4dad7616ebbcc5 (patch)
tree25716cfbd85da66da6af8732d858780c82f56401 /syweb/webclient/test
parentUse mRoomName on join notifications as well. (diff)
downloadsynapse-e3c3f5a6d04bfbc0256010e9fb4dad7616ebbcc5.tar.xz
Swap from using raw m.room.member events for room members to using actual RoomMember objects, so User objects can be tacked on. Update tests.
Diffstat (limited to 'syweb/webclient/test')
-rw-r--r--syweb/webclient/test/unit/event-handler-service.spec.js38
-rw-r--r--syweb/webclient/test/unit/filters.spec.js12
-rw-r--r--syweb/webclient/test/unit/model-service.spec.js2
3 files changed, 33 insertions, 19 deletions
diff --git a/syweb/webclient/test/unit/event-handler-service.spec.js b/syweb/webclient/test/unit/event-handler-service.spec.js
index 023abec98b..2a4dc3b5a5 100644
--- a/syweb/webclient/test/unit/event-handler-service.spec.js
+++ b/syweb/webclient/test/unit/event-handler-service.spec.js
@@ -36,20 +36,28 @@ describe('EventHandlerService', function() {
                 current_room_state: {
                     members: {
                         "@adam:matrix.org": {
-                            content: { membership: "join" },
-                            user_id: "@adam:matrix.org"
+                            event: {
+                                content: { membership: "join" },
+                                user_id: "@adam:matrix.org"
+                            }
                         },
                         "@beth:matrix.org": {
-                            content: { membership: "invite" },
-                            user_id: "@beth:matrix.org"
+                            event: {
+                                content: { membership: "invite" },
+                                user_id: "@beth:matrix.org"
+                            }
                         },
                         "@charlie:matrix.org": {
-                            content: { membership: "join" },
-                            user_id: "@charlie:matrix.org"
+                            event: {
+                                content: { membership: "join" },
+                                user_id: "@charlie:matrix.org"
+                            }
                         },
                         "@danice:matrix.org": {
-                            content: { membership: "leave" },
-                            user_id: "@danice:matrix.org"
+                            event: {
+                                content: { membership: "leave" },
+                                user_id: "@danice:matrix.org"
+                            }
                         }
                     }
                 }
@@ -70,12 +78,16 @@ describe('EventHandlerService', function() {
                 current_room_state: {
                     members: {
                         "@adam:matrix.org": {
-                            content: { membership: "join" },
-                            user_id: "@adam:matrix.org"
+                            event: {
+                                content: { membership: "join" },
+                                user_id: "@adam:matrix.org"
+                            }
                         },
                         "@beth:matrix.org": {
-                            content: { membership: "join" },
-                            user_id: "@beth:matrix.org"
+                            event: {
+                                content: { membership: "join" },
+                                user_id: "@beth:matrix.org"
+                            }
                         }
                     },
                     s: {
@@ -102,4 +114,4 @@ describe('EventHandlerService', function() {
         num = eventHandlerService.getUserPowerLevel(roomId, "@unknown:matrix.org");
         expect(num).toEqual(50);
     }));
-});
\ No newline at end of file
+});
diff --git a/syweb/webclient/test/unit/filters.spec.js b/syweb/webclient/test/unit/filters.spec.js
index 2e8d0c4036..7324a8e028 100644
--- a/syweb/webclient/test/unit/filters.spec.js
+++ b/syweb/webclient/test/unit/filters.spec.js
@@ -86,11 +86,13 @@ describe('mRoomName filter', function() {
                     inviter_user_id = user_id;
                 }
                 this.s["m.room.member" + user_id] = {
-                    content: {
-                        membership: membership
-                    },
-                    state_key: user_id,
-                    user_id: inviter_user_id 
+                    event: {
+                        content: {
+                            membership: membership
+                        },
+                        state_key: user_id,
+                        user_id: inviter_user_id 
+                    }
                 };
                 this.members[user_id] = this.s["m.room.member" + user_id];
             }
diff --git a/syweb/webclient/test/unit/model-service.spec.js b/syweb/webclient/test/unit/model-service.spec.js
index 2e012efe90..e2fa8ceba3 100644
--- a/syweb/webclient/test/unit/model-service.spec.js
+++ b/syweb/webclient/test/unit/model-service.spec.js
@@ -25,6 +25,6 @@ describe('ModelService', function() {
         });
         
         var user = modelService.getMember(roomId, userId);
-        expect(user.state_key).toEqual(userId);
+        expect(user.event.state_key).toEqual(userId);
     }));
 });