Open startswithaj opened 4 years ago
YES, I too need this option! I have been writing tests for reactive services all week and tracking down every single observable through the chain manually is not fun.
as a workaround: its usually visible from coverage where it stops.
Is there a way to configure a mock so that if a function or property is not stubbed using
when
it will throw an exception.I have issue where I will have mocked classes with member functions that are suppose to return observables, but when not stubbed just return null. The problem here is that if they are called from within an observable stream such as inside a
flatMap
an exception is thrown later sometimes after the test completes.Uncaught TypeError: You provided 'null' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable. thrown
It would be good if mocks were configurable so that if a member is not set or unimplemented - that when accessed the proxy would throw an exception.