I am trying to learn how to make unit testing for Angular with Karma and Jasmine.
My problem is that I make it with spyOn() and expect.toHaveBeenCalled() and even though Karma says that passed the tests, the Code Coverage is not updated.
I am new to angular unit testing and I dont know how to test methods properly so as to get code coverage.
Thanks everyone for the help.
spyOn(EnvironmentService, 'isProduction');
overwrites the service method and then EnvironmentService.isProduction();
is calling a spy instead of your method. Thus your method isn't called. valid test would be removing spy and will looke in some way like expect(EnvironmentService.isProduction()).toBe(false)