I am a bit stuck trying to test some Express Routes with SuperTest.
// Mocha test
..
request(app)
.get('/user')
.expect(200)
.end(function(err, res){
if (err) return done(err);
done()
});
...
// Router
app.get('/user', function(req, res){
res.render('user.jade');
});
The router works fine when I test it manually with the browser, and renders the jade template view but when I run the mocha tests it fails with 'Uncaught expected false to be true'. Express logs the request as successful (200), but the test still shows up as failed with the error message.
I have tried to use different code idioms for the SuperTest segment, different jade templates and it only seems to occur the first time I run a test on a router that renders a template. Following tests with GET even on the same router and template succeeeds???
Have tried to find code samples with routers that render a view without success, so perhaps this is an unsupported scenario?