You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.
Dart SDK version: 2.9.1 (stable) (Wed Aug 12 12:37:19 2020 +0200) on "linux_x64"
5.3.1
Linux
Chrome
Using NgTestBed to test simple components is very convenient. However, as soon as I start working with components that use other components that might depend on locally specified services, I'm in trouble. Let me illustrate:
So the dependency tree looks like so: AComponent -> BComponent -> SomeService. Looking at the generated code for AComponent. Naively, I attempted to mock BComponent's dependency, SomeService.
My assumption was that dependencies will be, in fact, retrieved from the DI system instead of static imports. It is clear, that as long as instantiation of SomeService happens via imports instead of using DI, my attempt at overriding it in the test will never work.
My question is so: am I limited to testing functionality of components with NgTestBed to components that do not depend on other components? If not, how do I go about resolving the use-case mentioned above?
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Dart SDK version: 2.9.1 (stable) (Wed Aug 12 12:37:19 2020 +0200) on "linux_x64"
Using
NgTestBed
to test simple components is very convenient. However, as soon as I start working with components that use other components that might depend on locally specified services, I'm in trouble. Let me illustrate:So the dependency tree looks like so:
AComponent -> BComponent -> SomeService
. Looking at the generated code forAComponent
. Naively, I attempted to mock BComponent's dependency,SomeService
.FakeSvc
has never been initialized and this is due to how.template.dart
files look:My assumption was that dependencies will be, in fact, retrieved from the DI system instead of static imports. It is clear, that as long as instantiation of
SomeService
happens via imports instead of using DI, my attempt at overriding it in the test will never work.My question is so: am I limited to testing functionality of components with NgTestBed to components that do not depend on other components? If not, how do I go about resolving the use-case mentioned above?
The text was updated successfully, but these errors were encountered: