mardi 8 décembre 2015

Trying to view `res.flash` in a mocha Controller test

I have the following Mocha test:

describe('#login()', function() {
before(function(){
   User.create({firstName:"Bob", lastName: "Balaban", password:"12345", email:"bob@bob.com"}) 
 });
it('should redirect to users/show', function (done) {
  request(sails.hooks.http.app)
    .post('/user/process')
    .send({ email: 'bob@bob.com', password: '12345' })
    .expect(302)
    .expect('location','/user/show')
    .expect(function(err, res){
      if (err) throw err;
      res.send({message:res.flash("message")});
    }, done); 
});
});

I am trying to access req.flash from within the test, however I can't see the info in the above code.

How do I go about seeing what my req.flash variable is returning?

Aucun commentaire:

Enregistrer un commentaire