Is there a way in jasmine.js to check if two arrays are equal, for example:
arr = [1, 2, 3] expect(arr).toBe([1, 2, 3]) expect(arr).toEqual([1, 2, 3])
Neither seems to work.
Just did the test and it works with toEqual
toEqual
please find my test:
http://jsfiddle.net/7q9N7/3/
describe('toEqual', function() { it('passes if arrays are equal', function() { var arr = [1, 2, 3]; expect(arr).toEqual([1, 2, 3]); }); });
Just for information:
toBe() versus toEqual(): toEqual() checks equivalence. toBe(), on the other hand, makes sure that they're the exact same object.
1.4m articles
1.4m replys
5 comments
57.0k users