aboutsummaryrefslogtreecommitdiffstats
path: root/core/js/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-03-06 14:49:12 +0100
committerVincent Petry <pvince81@owncloud.com>2014-03-06 14:49:12 +0100
commit6e4ea09d52b23c216109d020dcceea5370817a73 (patch)
tree8863e3147343b96917d8b2cc19e1efc2d29829de /core/js/tests
parentbfd0d799d81ce4a805055ce17b67272b13fff035 (diff)
parent32b29c9d735ae235641a7ea3869c14d7eb69cb4f (diff)
downloadnextcloud-server-6e4ea09d52b23c216109d020dcceea5370817a73.tar.gz
nextcloud-server-6e4ea09d52b23c216109d020dcceea5370817a73.zip
Merge pull request #7494 from owncloud/fix-7307
Replace OC.Router.generate() with OC.generateUrl()
Diffstat (limited to 'core/js/tests')
-rw-r--r--core/js/tests/specHelper.js9
-rw-r--r--core/js/tests/specs/coreSpec.js14
2 files changed, 4 insertions, 19 deletions
diff --git a/core/js/tests/specHelper.js b/core/js/tests/specHelper.js
index b1193240580..3ed4cb6c3b4 100644
--- a/core/js/tests/specHelper.js
+++ b/core/js/tests/specHelper.js
@@ -86,18 +86,9 @@ window.oc_defaults = {};
// make it globally available, so that other tests can define
// custom responses
window.fakeServer = fakeServer;
-
- OC.Router.routes = [];
- OC.Router.routes_request = {
- state: sinon.stub().returns('resolved'),
- done: sinon.stub()
- };
});
afterEach(function() {
- OC.Router.routes_request.state.reset();
- OC.Router.routes_request.done.reset();
-
// uncomment this to log requests
// console.log(window.fakeServer.requests);
fakeServer.restore();
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);