I\'m just starting out writing tests for my AngularJS app and am doing so in Jasmine.
Here are the relevant code snippets
ClientController:
\
Long story short: add angular.equals
as a jasmine matcher.
beforeEach(function(){
this.addMatchers({
toEqualData: function(expected) {
return angular.equals(this.actual, expected);
}
});
});
So, then you can use it as follows:
it('should preselect first client in array', function() {
//this passes:
expect(scope.selected.client).toEqualData(RESPONSE[0]);
//this fails:
expect(scope.selected.client).toEqual(RESPONSE[0]);
});