Skip to content

Instantly share code, notes, and snippets.

@Qquanwei
Created March 14, 2019 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Qquanwei/2f5005675dc808c4f6e6631934a11f07 to your computer and use it in GitHub Desktop.
Save Qquanwei/2f5005675dc808c4f6e6631934a11f07 to your computer and use it in GitHub Desktop.
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