I have something in my code like this.
$scope.callMe = function(test){
...
myService.test(
{'price':price, 'name':name, 'category': category, 'test': test}
) // category, price are complex objec
...
}
my unit test
it('should check the params', function(){
spyOn(myService.test).and.callThrough();
$scope.callMe('test1');
expect(myService).toHaveBeenCalled();
}
I want to create a unit test to see if myService
is called with a variable 'test1'
. I don't want to use toHaveBeenCalledWith()
because I have to mimic bunch of complex objects and I don't want to do that. The above test won't do it. Is there a way to solve it? Thanks a lot!
Aucun commentaire:
Enregistrer un commentaire