【发布时间】:2014-05-20 04:55:12
【问题描述】:
嘿,今天我在玩 Jasmine,我写了这个简单的 Person 对象
function Person() {}
Person.prototype.name = "Alex";
Person.prototype.age = 24;
这是我的规格测试
describe("Person", function() {
var someone = new Person();
it('should be equal to other people', function() {
var another = {
name: "Joe",
age: 25,
};
expect(someone).toEqual(another);
});
});
但它失败了,期望 { } 等于 { name : 'Alex', age : 24 } Jasmine 的 toEqual 匹配器不应该适用于对象吗?我在这里遗漏了什么吗?
谢谢!
【问题讨论】:
标签: javascript testing jasmine specs