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

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -