How can I do this with chai-as-promised:
Currently I am using chai expect:
return User.auth(data).then(function(usr){
expect(usr).to.have.property('user', 'alvin');
expect(usr).to.have.property('email', '[email protected]');
});
for chai-as-promisied, I can call mulutiple call but I would like to call once:
return User.auth(data).should.eventually.have.property('');
return User.auth(data).should.eventually.have.property('');
The solution:
it('should return user', function(){
this.timeout(15000);
let data = { req: {
email: '[email protected]'
}};
let expected = {
email: '[email protected]'
};
return
User.auth(data).should.be.fulfilled.and.eventually.include(expected);
});