我正在尝试运行以下测试:
describe('set()', function () {
var returnedUser = session.set(user);
it('should return a User object', function () {
//this works fine
return returnedUser.should.eventually.equal(user);
});
it('returned User object should have sessionId appended', function() {
//DOES NOT WORK; always passes
return returnedUser.should.eventually.hasOwnProperty('thisdoesnotexist');
});
});
我正在尝试找出正确的语法来测试返回的User
对象是否包含'sessionId'
属性。有人知道怎么做吗?
答案 0 :(得分:1)
通过仔细查看chaijs docs来了解这一点。
it('returned User object should have sessionId appended', function() {
return returnedUser.should.eventually.include.keys('sessionId');
});