I have a service which I'm consuming in my angular 2 unit test.
I call the service in the beforeEach block first with TestBed.get()
Example:
beforeEach(() => {
fixture = TestBed.createComponent(ConfigComponent);
component = fixture.componentInstance;
service = TestBed.get(ConfigService);
fixture.detectChanges();
});
I then use this service in the unit test like this:
Example:
it('should do something', inject([ConfigService], (configService) => {
// code here
}));
Do I need to inject the service in the unit test If called previously, or do I need to just call TestBed.get() and the use it across or should I do both?