Ionic 4 Unit Test error when injecting NavController

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?

Sorry for late response. I ran into this issue just couple of days ago. This post helped me resolve the issue. Importing either RouterModule.forRoot([]) or RouterTestingModule in the TestBed.configureTestingModule resolved the Error: StaticInjectorError(DynamicTestModule)[Location]: