VulpesOS/gaia/apps/system/test/unit/promise_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

33 lines
833 B
JavaScript
Executable file

/** global*/
'use strict';
suite('Promise', function() {
var subject;
setup(function() {
subject = {};
subject.promiseMethod = function() {
return Promise.resolve();
};
subject.promiseFirstFunctionErrorMethod = function() {
return new Promise((resolve) => {
throw new Error('This is an error.');
});
};
subject.promiseThenFunctionErrorMethod = function() {
return Promise.resolve().then(() => {
throw new Error('This is an error.');
});
};
});
test('what if error in the first method', function(done) {
subject.promiseFirstFunctionErrorMethod().catch((err) => {
done();
});
});
test('what if error in the then method', function(done) {
subject.promiseThenFunctionErrorMethod().catch((err) => {
done();
});
});
});