Skip to content

Commit

Permalink
test added
Browse files Browse the repository at this point in the history
  • Loading branch information
alekbarszczewski committed Oct 12, 2015
1 parent 7a9d2e1 commit d29c8ff
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion test/supertest.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,28 @@ describe('request(app)', function(){
.expect(302, done);
});

it('should handle redirects', function(done){
var app = express();

app.get('/login', function (req, res){
res.end('Login')
});

app.get('/', function(req, res){
res.redirect('/login');
});

request(app)
.get('/')
.redirects(1)
.end(function (err, res) {
should.exist(res)
res.status.should.be.equal(200)
res.text.should.be.equal('Login')
done()
})
});

it('should handle socket errors', function(done) {
var app = express();

Expand Down Expand Up @@ -1028,4 +1050,4 @@ describe("request.get(url).query(vals) works as expected", function(){
done();
});
});
});
});

0 comments on commit d29c8ff

Please sign in to comment.