Description of the bugHi, not sure if this is a bug or just me using ng-mocks incorrectly. For example: `` An example of the bugLink: Expected vs actual behaviorTest case succeeds |
Answered by
satanTime
Mar 5, 2023
Replies: 1 comment
|
Hi there, because beforeEach(async () => {
fixture = TestBed.createComponent(StandaloneComponent);
component = fixture.componentInstance;
service = fixture.debugElement.injector.get(ExampleService);
});An example is here: https://codesandbox.io/s/great-estrela-uzlu88?file=/src/test.spec.ts:916-976 |
0 replies
Answer selected by
satanTime
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there,
because
ExampleServiceis a provider of a component, you cannot useTestBed.injectto get its instance, you should use theinjectorof the relatedDebugNode:An example is here: https://codesandbox.io/s/great-estrela-uzlu88?file=/src/test.spec.ts:916-976