[Pkg-owncloud-commits] [owncloud] 58/223: Added unit tests for heartbeat interval min/max values

David Prévot taffit at moszumanska.debian.org
Sun Jun 22 01:54:06 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 6a0f5cfc619e8e7463883b8df1375b93bc68a4d1
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Thu Jun 12 18:42:09 2014 +0200

    Added unit tests for heartbeat interval min/max values
---
 core/js/tests/specs/coreSpec.js | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js
index 3c62b97..dd9d4a7 100644
--- a/core/js/tests/specs/coreSpec.js
+++ b/core/js/tests/specs/coreSpec.js
@@ -19,7 +19,6 @@
 *
 */
 
-/* global OC */
 describe('Core base tests', function() {
 	describe('Base values', function() {
 		it('Sets webroots', function() {
@@ -235,10 +234,12 @@ describe('Core base tests', function() {
 		});
 		afterEach(function() {
 			clock.restore();
+			/* jshint camelcase: false */
 			window.oc_config = oldConfig;
 			routeStub.restore();
 		});
 		it('sends heartbeat half the session lifetime when heartbeat enabled', function() {
+			/* jshint camelcase: false */
 			window.oc_config = {
 				session_keepalive: true,
 				session_lifetime: 300
@@ -265,6 +266,7 @@ describe('Core base tests', function() {
 			expect(counter).toEqual(2);
 		});
 		it('does no send heartbeat when heartbeat disabled', function() {
+			/* jshint camelcase: false */
 			window.oc_config = {
 				session_keepalive: false,
 				session_lifetime: 300
@@ -279,6 +281,26 @@ describe('Core base tests', function() {
 			// still nothing
 			expect(counter).toEqual(0);
 		});
+		it('limits the heartbeat between one minute and one day', function() {
+			/* jshint camelcase: false */
+			var setIntervalStub = sinon.stub(window, 'setInterval');
+			window.oc_config = {
+				session_keepalive: true,
+				session_lifetime: 5
+			};
+			window.initCore();
+			expect(setIntervalStub.getCall(0).args[1]).toEqual(60 * 1000);
+			setIntervalStub.reset();
+
+			window.oc_config = {
+				session_keepalive: true,
+				session_lifetime: 48 * 3600
+			};
+			window.initCore();
+			expect(setIntervalStub.getCall(0).args[1]).toEqual(24 * 3600 * 1000);
+
+			setIntervalStub.restore();
+		});
 	});
 	describe('Parse query string', function() {
 		it('Parses query string from full URL', function() {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list