Created
March 14, 2019 10:01
-
-
Save Qquanwei/2f5005675dc808c4f6e6631934a11f07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { of, always } from 'OverAssert'; | |
function asyncCheckValidate(value) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
if (value > 10) { | |
resolve(); | |
} else { | |
reject(); | |
} | |
}, 100); | |
}) | |
} | |
of(7) | |
.map(itShould(asyncCheckValidate, always('check failed'))) | |
.validate((success, reason) => { | |
// success = false, reason = 'check failed' | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment