summary refs log tree commit diff
path: root/syweb/webclient/test
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-11-14 09:20:36 +0000
committerKegan Dougal <kegan@matrix.org>2014-11-14 09:20:36 +0000
commit656bf2c60caaca41de061c459654eb8a17465fc9 (patch)
tree6b58621a4fb47eb2554890cd8c95c2d0f596e4f1 /syweb/webclient/test
parentRemove getUserDisplayName and move that logic the filter mUserDisplayName. Up... (diff)
downloadsynapse-656bf2c60caaca41de061c459654eb8a17465fc9.tar.xz
Unskip unit tests; fix filter dependency.
Diffstat (limited to 'syweb/webclient/test')
-rw-r--r--syweb/webclient/test/unit/filters.spec.js30
1 files changed, 18 insertions, 12 deletions
diff --git a/syweb/webclient/test/unit/filters.spec.js b/syweb/webclient/test/unit/filters.spec.js
index d0392eeb71..4377c33147 100644
--- a/syweb/webclient/test/unit/filters.spec.js
+++ b/syweb/webclient/test/unit/filters.spec.js
@@ -1,4 +1,4 @@
-xdescribe('mRoomName filter', function() {
+describe('mRoomName filter', function() {
     var filter, mRoomName, mUserDisplayName;
     
     var roomId = "!weufhewifu:matrix.org";
@@ -29,28 +29,34 @@ xdescribe('mRoomName filter', function() {
     
     beforeEach(function() {
         // inject mocked dependencies
-        module(function ($provide, $filterProvider) {
+        module(function ($provide) {
             $provide.value('matrixService', matrixService);
             $provide.value('modelService', modelService);
-            $provide.value('mUserDisplayNameFilter', function(a,b){return "boo";});
         });
         
         module('matrixFilter');
+        
+        // angular resolves dependencies with the same name via a 'last wins'
+        // rule, hence we need to have this mock filter impl AFTER module('matrixFilter')
+        // so it clobbers the actual mUserDisplayName implementation.
+        module(function ($filterProvider) {
+            // provide a fake filter
+            $filterProvider.register('mUserDisplayName', function() {
+                return function(user_id, room_id) {
+                    if (user_id === testUserId) {
+                        return testDisplayName;
+                    }
+                    return testOtherDisplayName;
+                };
+            });
+        });
     });
     
+    
     beforeEach(inject(function($filter) {
         filter = $filter;
         mRoomName = filter("mRoomName");
         
-        // provide a fake filter
-        
-        spyOn($filter, "mUserDisplayName").and.callFake(function(user_id, room_id) {
-            if (user_id === testUserId) {
-                return testDisplayName;
-            }
-            return testOtherDisplayName;
-        });
-        
         // purge the previous test values
         testUserId = undefined;
         testAlias = undefined;