Trying to create a basic unit test for an Angular component that injects NavController.
When running the test getting the error
Error: StaticInjectorError(DynamicTestModule)[Location]:
StaticInjectorError(Platform: core)[Location]:
NullInjectorError: No provider for Location!
If I remove the NavController from the component I no longer get this error.
I tried mocking NavController like below and still get this error.
class NavControllerMock {
}
describe(‘MenuService’, () => {
TestBed.configureTestingModule({
providers: [
{ provide: NavController, useClass: NavControllerMock}
],
});
Any suggestions?