Skip to content

Instantly share code, notes, and snippets.

@danielstocks
Created April 25, 2012 16:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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

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