我怎么能用 chai-as-promised 做到这一点:
目前我正在使用柴期望:
return User.auth(data).then(function(usr){
expect(usr).to.have.property('user', 'alvin');
expect(usr).to.have.property('email', 'alvin@l.com');
});
对于 chai-as-promisied,我可以拨打多个电话,但我想拨打一次:
return User.auth(data).should.eventually.have.property('');
return User.auth(data).should.eventually.have.property('');
解决方案:
it('should return user', function(){
this.timeout(15000);
let data = { req: {
email: 'alvin@l.com'
}};
let expected = {
email: 'alvin@l.com'
};
return
User.auth(data).should.be.fulfilled.and.eventually.include(expected);
});