Wednesday, April 26, 2017

Jasmine mocking!

spyOn(myService, 'myMethod').and.callFake(() => {
   return {
      then: (callback) => {
         callback(someVariableForSomething);
      }
   };
});

 
 

The following in contrast to what is above will just make a method on a service do nothing and return nothing when called.

spyOn(myService, 'myMethod');

No comments:

Post a Comment