Skip to content

Instantly share code, notes, and snippets.

@SteveHoggNZ
Created May 5, 2016 10:06
Show Gist options
  • Save SteveHoggNZ/0173a628d6a0279e8912418baadc8d2b to your computer and use it in GitHub Desktop.
Save SteveHoggNZ/0173a628d6a0279e8912418baadc8d2b to your computer and use it in GitHub Desktop.
Chai As Promised
// shorthand for result that is a promise
it(() => {
return expect(result)
.to.eventually.deep.equal({url, options})
})
// ... longhand, which handles multiple promises in a test, and is
// easier to debug (by inserting console.log in then handler)
it(() => {
return Promise.all([
result.then((value) => expect(value).to.deep.equal({url, options}))
])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment