Browse Source

feat(kept-promise): add test

pull/1862/head
nprimo 2 years ago committed by Niccolò Primo
parent
commit
7553d3d994
  1. 23
      js/tests/kept-promise_test.js

23
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)

Loading…
Cancel
Save