Request you to help me find the solution of below issue. I have one function and corresponding Jasmine test case, like the one written below. If I use angular.copy (and I have to use this only) in my function, Jasmine test case fails and error shown is expected 'originalValue' to equal 'newValue'. If I use var obj = param1 (and not angular.copy) then Jasmine test case executes successfully. I have to use angular.copy and at the same time, want jasmine test case to pass. Please help.
function
function func(param1, param2, condition)
{
var obj = angular.copy(param1);
if(condition){
obj.prop = param2;
}
}
jasmine test case
it('xxxx', function(){
var obj = {'prop': 'orignialValue'};
func(param, 'newValue', true);
expect(obj.prop).toEqual('newValue');
});
Aucun commentaire:
Enregistrer un commentaire