mardi 27 novembre 2018

Is there a way to set the value of a spy/mock within a test in Angular 6 TestBed

I currently have been trying to mock/stub/spy on a service so that I can set the return value to something different for a number of tests.

eg.

mockService.getCountOfItems.and.returnValue.(of(1));
// some expectations


mockService.getCountOfItems.and.returnValue.(of(0));
// some expectations

However this for some reason seems impossible. Am I missing something really obvious here?

Thanks

Aucun commentaire:

Enregistrer un commentaire