Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Testing multiple HTTP status codes
/*
* 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);
});
}
});
@danielstocks
Copy link
Author

danielstocks commented Apr 25, 2012

The same could be applied to check for 200, 201, 206 etc. for success callbacks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment