Closed Tuizi closed 7 years ago
Ok so it works if in the generated test I do this changes:
Generated tests from Simon
describe('ngOnInit', () => {
it('makes expected calls', () => {
spyOn(totoServiceStub, 'get');
comp.ngOnInit();
expect(totoServiceStub.get).toHaveBeenCalled();
});
});
Fixed tests
describe('ngOnInit', () => {
it('makes expected calls', () => {
// Get injected service
const totoServiceStubInjected = fixture.debugElement.injector.get(TotoService) as any;
spyOn(totoServiceStubInjected, 'get');
comp.ngOnInit();
expect(totoServiceStubInjected.get).toHaveBeenCalled();
});
});
Do you think that it's something that should be automatically made by the extension?
You just gave me a good reason for using fixture.debugElement.injector.get
. I'll update the generator to use that.
Sorry for the delay. Pick up v0.12.0
On each test generated, the
makes expected calls
always fail. Here an example:app.component.ts
app.component.spec.ts
Also if I do:
The
debugger
is never called and I don't see 'toto' in the console either