2

こんにちは、今日ジャスミンと遊んでいて、この単純な 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);
});
});

それでも、Expected { } to equal { name : 'Alex', age : 24 } で失敗します Jasmine の toEqual マッチャーはオブジェクトに対して機能するべきではありませんか? ここで何か不足していますか?

ありがとう!

4

1 に答える 1