Skip to content

Instantly share code, notes, and snippets.

@Qquanwei
Created March 19, 2019 02:20
Show Gist options
  • Save Qquanwei/da8fa7553d05a47a573809056789cb3a to your computer and use it in GitHub Desktop.
Save Qquanwei/da8fa7553d05a47a573809056789cb3a to your computer and use it in GitHub Desktop.
function imageMatch(file) {
return readImageAsPromise(file).then(image => {
return of(image).map(itShouldProp('width', large(10), always('image width should large 10, now is ' + image.width)))
})
}
of({ filename: 'c:/fakepath/file.txt'})
.map(itShould(imageMatch, always('image not exists')))
.validate(( success, reason) => {
// async validation just fun
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment