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

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -