Change value of observable returned by mocked service for each test in Angular/Jasmine/Redux

You said in your question that you want "the mock service to return different values for each unit test." To do this you are going to have to make some changes to the way your component is defined.

  1. The most important change is to move the subscription into ngOnInit() and out of the constructor for your component. If you do this, then you can control when the subscription fires, otherwise it will fire when the component is created making it very difficult to return different values for each unit test.

  2. Once that is done, then you need to be careful where you call fixture.detectChanges(). This is because that will execute ngOnInit(), which will execute the subscription and store the value returned from the Observable into component.test. Note that since you are using of() it will simply emit once and then complete. It will not emit again if you put a new value into testService.test$.

  3. Once you have this set up, then you can change the value of testService.test$ BEFORE you call fixture.detectChanges and make the values whatever you would like.

I have set up a StackBlitz to demonstrate this, changing your code as little as possible just to get it to work. There are two tests, each testing different values returned.

I hope this helps!