Hello Romanchuk!
Unfortunately, your example does not help me :/
Can you give some advice pls, what did I do wrong?
When I run my test file, I get 2 errors:
1.) NullInjectorError: No provider for InjectionToken I18NEXT_SERVICE!
2.) Error: The pipe 'i18next' could not be found!
Hello Romanchuk! Unfortunately, your example does not help me :/ Can you give some advice pls, what did I do wrong?
When I run my test file, I get 2 errors: 1.) NullInjectorError: No provider for InjectionToken I18NEXT_SERVICE! 2.) Error: The pipe 'i18next' could not be found!
And my Test file:
`export function appInit(i18next: ITranslationService) { return () => { const promise: Promise = i18next .init({ debug: true, lng: 'cimode' }); return promise; }; }
export function localeIdFactory(i18next: ITranslationService) { return i18next.language; }
export const I18N_PROVIDERS = [ { provide: APP_INITIALIZER, useFactory: appInit, deps: [I18NEXT_SERVICE], multi: true }, { provide: LOCALE_ID, deps: [I18NEXT_SERVICE], useFactory: localeIdFactory }, ];
describe('NavComponent', () => { let component: NavComponent; let fixture: ComponentFixture;
beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ BrowserModule, UiElementsModule, RouterTestingModule, HttpClientModule, BrowserAnimationsModule, MatExpansionModule, I18NextModule.forRoot() ], declarations: [ NavComponent ], providers: [ { provide: 'environment', useValue: environment }, { provide: UserManagerService, useClass: MockUserManagerService }, I18N_PROVIDERS ], }) .compileComponents(); });`