I use this gist to read the configuration file during application startup. This works fine, but when I run unit tests, I get an error Cannot read property 'SomeProperty' of null.
I also added a provider for testing
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoginComponent ],
imports: [ReactiveFormsModule, RouterTestingModule, HttpModule],
providers: [AuthService,
SettingsService,
AppConfig,
{
provide: APP_INITIALIZER,
useFactory: initConfig,
deps: [AppConfig],
multi: true
},
]
})
.compileComponents();
}));
Any pointers to resolve this issue. Thanks in advance.
source
share