Skip to content

Instantly share code, notes, and snippets.

@mansona
Created December 4, 2012 11:57
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 mansona/4203045 to your computer and use it in GitHub Desktop.
Save mansona/4203045 to your computer and use it in GitHub Desktop.
Mocha Zombie exception thrown on 401 status code
var expect = require('expect.js'),
Browser = require('zombie');
var browser = new Browser({waitDuration: 1500});
describe('Status Codes', function(){
this.timeout(2000);
it('Unauthorized', function(done){
browser.visit("http://status.savanttools.com/?code=401%20Unauthorized").then(function () {
expect(browser.statusCode).to.equal(401);
done();
}).fail(function(e){
if(browser.statusCode == 401){
return done();
}
console.log("Error Thrown: ");
console.log(e);
console.log("Status Code: " + browser.statusCode);
done(e);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment