I am creating a basic tenpin bowling scoring program in JavaScript. To do this I have created the different functions Frame and Game so far. I have created a frame double for testing my game function. The test I am having problems on is this:
it('can take a frame as a parameter', function(){
frame.frameOne.and.callFake(function(){
[5, 5, 'spare'];
});
expect(game.frame1(frame)).toBe([5, 5, 'spare']);
});`
and the game logic it is testing is this:
Game.prototype.frame1 = function (frame) {
frame.frameOne;
return [5, 5, 'spare'];
};
Now I'm pretty sure the code is probably all wrong being as I'm new to Javascript/Jasmine and coding in general but what I'm confused about is when I run the test I am getting this error from Jasmine:
Expected [ 5, 5, 'spare' ] to be [ 5, 5, 'spare' ]
Now to me that reads as a match, not a fail?!? I have swapped the arrays for the value true which then passes so why are the Arrays apparently an identical match but Jasmine is saying they are not and failing?
Ideas?!?