Skip to content

Instantly share code, notes, and snippets.

@patoi
Last active April 3, 2018 09:33
Show Gist options
  • Save patoi/9854f8b10022e9dd836d2aa016069626 to your computer and use it in GitHub Desktop.
Save patoi/9854f8b10022e9dd836d2aa016069626 to your computer and use it in GitHub Desktop.
it('is OK - better way', async function() {
let result, error
try {
result = await testFunction(true)
} catch (err) {
error = err
} finally {
expect(error).to.be.undefined() // guard: handling code flaw
expect(result).to.be.equal('OK')
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment