summary refs log tree commit diff
path: root/syweb
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-11-06 14:18:23 +0000
committerKegan Dougal <kegan@matrix.org>2014-11-06 14:18:23 +0000
commitb77cce4ec56c3b4fd74ea65416e030fc321d4fa4 (patch)
tree34482dde4eef7eb754534b442837d8f6666e0d4f /syweb
parentFactor out room name logic: mRoomName is the canonical source. (diff)
downloadsynapse-b77cce4ec56c3b4fd74ea65416e030fc321d4fa4.tar.xz
Add modelService test. Thin for now but will be expanded upon.
Diffstat (limited to 'syweb')
-rw-r--r--syweb/webclient/test/unit/model-service.spec.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/syweb/webclient/test/unit/model-service.spec.js b/syweb/webclient/test/unit/model-service.spec.js
new file mode 100644
index 0000000000..2e012efe90
--- /dev/null
+++ b/syweb/webclient/test/unit/model-service.spec.js
@@ -0,0 +1,30 @@
+describe('ModelService', function() {
+
+    // setup the dependencies
+    beforeEach(function() {
+        // dependencies
+        module('matrixService');
+        
+        // tested service
+        module('modelService');
+    });
+
+    it('should be able to get a member in a room', inject(
+    function(modelService) {
+        var roomId = "!wefiohwefuiow:matrix.org";
+        var userId = "@bob:matrix.org";
+        
+        modelService.getRoom(roomId).current_room_state.storeStateEvent({
+            type: "m.room.member",
+            id: "fwefw:matrix.org",
+            user_id: userId,
+            state_key: userId,
+            content: {
+                membership: "join"
+            }
+        });
+        
+        var user = modelService.getMember(roomId, userId);
+        expect(user.state_key).toEqual(userId);
+    }));
+});