Created
April 25, 2012 16:13
-
-
Save danielstocks/2490995 to your computer and use it in GitHub Desktop.
Testing multiple HTTP status codes
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
/* | |
* Disregard the fact that I'm using Array.forEach here | |
*/ | |
TestCase("ReadyStateHandlerTest", { | |
"test should call failure handler for 404, 400, 500": function() { | |
var _this = this; | |
[400, 404, 500].forEach(function(status) { | |
var request = forceStatusAndReadyState(_this.xhr, status, 4) | |
assert(request.failure); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The same could be applied to check for 200, 201, 206 etc. for success callbacks?