Simple Observable Unit Testing in Angular2
Chris Pawlukiewicz
2989

Thanks for taking the time to write this!
I also like the separation of mock/stub and mock/stub data in different files.

I have some questions though:

  1. What about the following naming convention that I use:

some.service.ts
some.service.stub.ts

As I see it, the stub file represents a some service stub and not a some stub. if you exclude the .service in the filename, it could look like I’m stubbing a model, or a piece of data, instead of a service.

What do you think?

2. What do you think about keeping the stubs next to the services, just like specs?

any.service.ts
any.service.spec.ts
any.service.stub.ts

3. Also, I read somewhere that 
fixture.detectChanges(); already executes ngOnInit() behind the scenes, but that might have been changed in a recent Angular version. Do you happen to know anything about that ?

Like what you read? Give Michael Trouw a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.