Unit test: Mocking service that returns observables to return subjects in order to test change of values over time causes TS to throw TS2339
问题 I have a service that returns the values exposed by ngrx selectors, and a component that defines this service, injects it and sets properties based on the values returned by the service. I am writing unit tests for the component using a mock of the service, and I need the mock service to return different values for each unit test. In order to do this I have defined the mock service class so it returns subjects instead of observables. The tests run, but TS throws an error saying that the