jeudi 5 mai 2016

Jasmine - Method not being called

var obj = {};

obj.localContext = 'firstTemp';

  obj.call = function(){
    obj.localContext = 'secondTemp';
  };

Jasmine-spec:

it('value of localContext', function(){
  spyOn(obj, 'call');
  obj.call();
  expect(obj.localContext).toEqual('secondTemp');
});

Why is the obj.call() method never being called? When I run the spec, the value of obj.localContext is still firstTemp instead of secondTemp

Aucun commentaire:

Enregistrer un commentaire