node.js - supertest: test the redirection url -
with supertest, can test redirection code 302
var request = require('supertest'); var app = require('../server').app; describe('test route', function(){ it('return 302', function(done){ request(app) .get('/fail_id') .expect(302, done); }); it('redirect /'); });
how can test url objetive redirect ?
it('redirect /', function(done){ request(app) .get('/fail_id') .expect('location', /\//, done); });
Comments
Post a Comment