Skip to content

Commit

Permalink
Merge pull request #123 from touzbi/master
Browse files Browse the repository at this point in the history
Added http status code tests (400, 401, 403)
  • Loading branch information
jasondeveloper-1099 committed Nov 9, 2014
2 parents e5398f9 + 63caa5a commit de86a85
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/errorHandling.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,36 @@ describe('Errors', function() {
var c = new Crawler({
jQuery : false
});
it('should not return an error on status code 400 (Bad Request)', function(done) {
c.queue({
uri: 'http://' + httpbinHost + '/status/400',
callback: function(error, response, $){
expect(error).to.be.null;
expect(response.statusCode).to.equal(400);
done();
}
});
});
it('should not return an error on status code 401 (Unauthorized)', function(done) {
c.queue({
uri: 'http://' + httpbinHost + '/status/401',
callback: function(error, response, $){
expect(error).to.be.null;
expect(response.statusCode).to.equal(401);
done();
}
});
});
it('should not return an error on status code 403 (Forbidden)', function(done) {
c.queue({
uri: 'http://' + httpbinHost + '/status/403',
callback: function(error, response, $){
expect(error).to.be.null;
expect(response.statusCode).to.equal(403);
done();
}
});
});
it('should not return an error on a 404', function(done) {
c.queue({
uri : 'http://'+httpbinHost+'/status/404',
Expand Down

0 comments on commit de86a85

Please sign in to comment.