Skip to content

Instantly share code, notes, and snippets.

@danielstocks
Created April 25, 2012 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielstocks/2490995 to your computer and use it in GitHub Desktop.
Save danielstocks/2490995 to your computer and use it in GitHub Desktop.
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