diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-03-05 01:10:39 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-03-05 01:10:39 +0100 |
commit | 33b798c3d6e28370270925cce873883a333cdbc2 (patch) | |
tree | 4bbfc828395ce1adbc256ec0e34d063bd4e8d3f8 /core | |
parent | 5f711912a1f6db7a2f28105101f808e89a2efe50 (diff) | |
download | nextcloud-server-33b798c3d6e28370270925cce873883a333cdbc2.tar.gz nextcloud-server-33b798c3d6e28370270925cce873883a333cdbc2.zip |
fixing js unit tests
Diffstat (limited to 'core')
-rw-r--r-- | core/js/core.json | 1 | ||||
-rw-r--r-- | core/js/tests/specHelper.js | 1 | ||||
-rw-r--r-- | core/js/tests/specs/coreSpec.js | 14 |
3 files changed, 5 insertions, 11 deletions
diff --git a/core/js/core.json b/core/js/core.json index 4beab7cf796..665e2485a90 100644 --- a/core/js/core.json +++ b/core/js/core.json @@ -17,7 +17,6 @@ "eventsource.js", "config.js", "multiselect.js", - "router.js", "oc-requesttoken.js" ] } diff --git a/core/js/tests/specHelper.js b/core/js/tests/specHelper.js index b1193240580..84c5e8f75bc 100644 --- a/core/js/tests/specHelper.js +++ b/core/js/tests/specHelper.js @@ -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'), diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js index 478505e9287..bb43810ef16 100644 --- a/core/js/tests/specs/coreSpec.js +++ b/core/js/tests/specs/coreSpec.js @@ -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); |