VulpesOS/gaia/apps/system/test/unit/scheduler_test.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

43 lines
No EOL
1,006 B
JavaScript
Executable file

/* global BaseModule */
'use strict';
requireApp('system/js/service.js');
requireApp('system/js/base_module.js');
requireApp('system/js/scheduler.js');
suite('system/scheduler', function() {
var subject;
setup(function() {
subject = BaseModule.instantiate('Scheduler');
subject.start();
});
teardown(function() {
subject.stop();
});
test('Should hold the operations until released', function() {
var spy1 = this.sinon.spy();
var spy2 = this.sinon.spy();
subject.schedule(spy1);
subject.schedule(spy2);
assert.isFalse(spy1.called);
assert.isFalse(spy2.called);
subject.release();
assert.isTrue(spy1.called);
assert.isTrue(spy2.called);
});
test('Should proceed the operations if it is not blocking now', function() {
var spy1 = this.sinon.spy();
var spy2 = this.sinon.spy();
subject.release();
subject.schedule(spy1);
subject.schedule(spy2);
assert.isTrue(spy1.called);
assert.isTrue(spy2.called);
});
});