Created
May 5, 2016 10:06
-
-
Save SteveHoggNZ/0173a628d6a0279e8912418baadc8d2b to your computer and use it in GitHub Desktop.
Chai As Promised
This file contains hidden or 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
// 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