Hello,
I am receiving the following error when attempting to test with Ionic Native Geolocation as a dependency:
Failed: R3InjectorError(DynamicTestModule)[Geolocation -> Geolocation]:
NullInjectorError: No provider for Geolocation!
error properties: Object({ ngTempTokenPath: null, ngTokenPath: [ 'Geolocation', 'Geolocation' ] })
NullInjectorError: R3InjectorError(DynamicTestModule)[Geolocation -> Geolocation]:
NullInjectorError: No provider for Geolocation!
Here is what the test set up looks like:
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule, IonItem, Platform } from '@ionic/angular';
import { FoloLocation } from '../models/folo-location';
import { Geolocation } from '@ionic-native/geolocation/ngx';
import { HomePage } from './home.page';
describe('HomePage', () => {
let component: HomePage;
let fixture: ComponentFixture<HomePage>;
let platform: Platform;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ HomePage ],
imports: [IonicModule.forRoot()],
providers: [
Geolocation
]
}).compileComponents();
fixture = TestBed.createComponent(HomePage);
component = fixture.componentInstance;
platform = TestBed.inject(Platform);
fixture.detectChanges();
}));
I have also tried providing a mock, to no avail.