-
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 |
Beta Was this translation helpful? Give feedback.
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 |
Beta Was this translation helpful? Give feedback.
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
ExampleService
is a provider of a component, you cannot useTestBed.inject
to get its instance, you should use theinjector
of the relatedDebugNode
:An example is here: https://codesandbox.io/s/great-estrela-uzlu88?file=/src/test.spec.ts:916-976