2015-06-09 12:02:15 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
describe('AppJS', function() {
|
|
|
|
|
describe('Automatic page refresh', function(){
|
|
|
|
|
var clock;
|
|
|
|
|
beforeEach(function () {
|
2015-06-20 19:48:38 +00:00
|
|
|
clock = sandbox.useFakeTimers();
|
|
|
|
|
sandbox.stub(window, "refresher", function(){return true});
|
2015-06-09 12:02:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should not call refresher if idle time is less than 6 hours', function() {
|
|
|
|
|
window.awaitIdle();
|
|
|
|
|
clock.tick(21599999);
|
|
|
|
|
expect(window.refresher).to.not.be.called;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should not call refresher if awaitIdle is called within 6 hours', function() {
|
|
|
|
|
window.awaitIdle();
|
|
|
|
|
clock.tick(21500000);
|
|
|
|
|
window.awaitIdle();
|
|
|
|
|
clock.tick(21500000);
|
|
|
|
|
expect(window.refresher).to.not.be.called;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should call refresher if idle time is 6 hours or greater', function() {
|
|
|
|
|
window.awaitIdle();
|
2016-09-18 19:51:20 +00:00
|
|
|
clock.tick(21900000);
|
2015-06-09 12:02:15 +00:00
|
|
|
expect(window.refresher).to.be.called;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|