Created
December 4, 2012 11:57
-
-
Save mansona/4203045 to your computer and use it in GitHub Desktop.
Mocha Zombie exception thrown on 401 status code
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
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