diff --git a/js/tests/kept-promise_test.js b/js/tests/kept-promise_test.js index dd35de170..e752c87ec 100644 --- a/js/tests/kept-promise_test.js +++ b/js/tests/kept-promise_test.js @@ -1,6 +1,19 @@ -import keptPromise +export const tests = [] -const getImportantInfo = _ => - new Promise(resolve => { - setTimeout(_ => resolve(Math.round(Math.random() * 10)), 1000) - }) +const testZero = async _ => { + return (await processInfo(_ => new Promise(resolve => resolve(0)))) === 'Ok!' +} + +const testOddNumber = async _ => { + return ( + (await processInfo(_ => new Promise(resolve => resolve(1)))) === 'Error!' + ) +} + +const testEvenNumber = async _ => { + return (await processInfo(_ => new Promise(resolve => resolve(4)))) === 'Ok!' +} + +tests.push(testZero, testOddNumber, testEvenNumber) + +Object.freeze(tests)