I've just started to "learn" testing in angular, and my task is first just to successfully run ng test on a existing project.
Almost all of the default generated component tests has errors ("it should create"), since it has dependecies, like translate etc. I've just figured out that, I have to import some dependencies into the TestBed.configureTestingModule
section, but for the translate and localize pipes which are coming from @gilsdav/ngx-translate-router and @ngx-translate/core
is not working I got a "The pipe 'localize' could not be found in the..."
. If I put imports: [TranslateModule.forRoot()],
into the configureTestingModule it feels like it is working, but for the localize it is not (tried to put the localizeroutermodule in it)
My question is, how should I import these into the components test if I want to successfully load the ng test without errors firstly for the "should create" "it".
Angular 13.3, jasmine-core 3.10.0, karma 6.3.0"
Node 16.15.1
Looks like import like this:
imports: [RouterTestingModule, TranslateModule.forRoot(), LocalizeRouterModule.forRoot([])],
fixed it.