Created
October 25, 2018 19:30
-
-
Save joelmccracken/247a8e5218c2b7d43192b46352c55755 to your computer and use it in GitHub Desktop.
This file contains 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
function assertThrows(triggeringFn, testFn) { | |
var sawError = false; | |
try { | |
triggeringFn(); | |
} catch (Exception e) { | |
sawError = true; | |
assert(testFn(e), "Exception did not pass test!"); | |
} | |
assert(sawError, "Error was not thrown!"); | |
} | |
assertThrows(foo, (e)=> e.statusCode == STATUS_CODE_NOT_FOUND) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment