]> source.dussan.org Git - nextcloud-server.git/commitdiff
fixing js unit tests
authorThomas Müller <thomas.mueller@tmit.eu>
Wed, 5 Mar 2014 00:10:39 +0000 (01:10 +0100)
committerThomas Müller <thomas.mueller@tmit.eu>
Wed, 5 Mar 2014 00:10:39 +0000 (01:10 +0100)
core/js/core.json
core/js/tests/specHelper.js
core/js/tests/specs/coreSpec.js

index 4beab7cf796d27a0d4d8650b0aaabb0e167a664b..665e2485a9042e2a46aecda61b3f76a4d6012bc4 100644 (file)
@@ -17,7 +17,6 @@
                "eventsource.js",
                "config.js",
                "multiselect.js",
-               "router.js",
                "oc-requesttoken.js"
        ]
 }
index b11932405806a10aae40ca8fea84090e4e7deb34..84c5e8f75bc3f15a430ad2ee890d5d321642be64 100644 (file)
@@ -87,6 +87,7 @@ window.oc_defaults = {};
                // custom responses
                window.fakeServer = fakeServer;
 
+               OC.Router = {};
                OC.Router.routes = [];
                OC.Router.routes_request = {
                        state: sinon.stub().returns('resolved'),
index 478505e928767fb7fd2aa190a76451b8b7e54848..bb43810ef164d1bfa1b4b96ecab5bc744c885064 100644 (file)
@@ -179,7 +179,7 @@ describe('Core base tests', function() {
                });
                it('Encodes special characters', function() {
                        expect(OC.buildQueryString({
-                               unicode: '汉字',
+                               unicode: '汉字'
                        })).toEqual('unicode=%E6%B1%89%E5%AD%97');
                        expect(OC.buildQueryString({
                                b: 'spaace value',
@@ -199,22 +199,20 @@ describe('Core base tests', function() {
                                'booleantrue': true
                        })).toEqual('booleanfalse=false&booleantrue=true');
                        expect(OC.buildQueryString({
-                               'number': 123,
+                               'number': 123
                        })).toEqual('number=123');
                });
        });
        describe('Session heartbeat', function() {
                var clock,
                        oldConfig,
-                       loadedStub,
                        routeStub,
                        counter;
 
                beforeEach(function() {
                        clock = sinon.useFakeTimers();
                        oldConfig = window.oc_config;
-                       loadedStub = sinon.stub(OC.Router, 'registerLoadedCallback');
-                       routeStub = sinon.stub(OC.Router, 'generate').returns('/heartbeat');
+                       routeStub = sinon.stub(OC, 'generateUrl').returns('/heartbeat');
                        counter = 0;
 
                        fakeServer.autoRespond = true;
@@ -227,7 +225,6 @@ describe('Core base tests', function() {
                afterEach(function() {
                        clock.restore();
                        window.oc_config = oldConfig;
-                       loadedStub.restore();
                        routeStub.restore();
                });
                it('sends heartbeat half the session lifetime when heartbeat enabled', function() {
@@ -236,9 +233,7 @@ describe('Core base tests', function() {
                                session_lifetime: 300
                        };
                        window.initCore();
-                       expect(loadedStub.calledOnce).toEqual(true);
-                       loadedStub.yield();
-                       expect(routeStub.calledWith('heartbeat')).toEqual(true);
+                       expect(routeStub.calledWith('/heartbeat')).toEqual(true);
 
                        expect(counter).toEqual(0);
 
@@ -264,7 +259,6 @@ describe('Core base tests', function() {
                                session_lifetime: 300
                        };
                        window.initCore();
-                       expect(loadedStub.notCalled).toEqual(true);
                        expect(routeStub.notCalled).toEqual(true);
 
                        expect(counter).toEqual(0);