Estoy tratando de escribir una prueba de unidad para un componente que usa GooglePlaceModule. Sigo recibiendo una prueba fallida con el siguiente error:
Failed: Google maps library can not be foundProbé 2 cosas en línea mientras buscaba resoluciones:
Agregué esta línea en el archivo karma.conf.js según la sugerencia:
files: [ 'https://maps.googleapis.com/maps/api/js?key=<key>=places&language=enhttps://maps.google.com/maps/api/js?key=<removed>&libraries=places' ],Eso no funcionó.
Aquí está mi archivo de especificaciones:
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { IonicModule } from '@ionic/angular'; import { ProfileFormComponent } from './profile-form.component'; import { ReactiveFormsModule } from '@angular/forms'; import { GooglePlaceModule } from 'ngx-google-places-autocomplete'; describe('ProfileFormComponent', () => { let component: ProfileFormComponent; let fixture: ComponentFixture<ProfileFormComponent>; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ ProfileFormComponent ], imports: [IonicModule.forRoot(), ReactiveFormsModule, GooglePlaceModule] }).compileComponents(); window['google'] = { maps: { Maps: () => {} } }; fixture = TestBed.createComponent(ProfileFormComponent); component = fixture.componentInstance; fixture.detectChanges(); })); it('should create', () => { expect(component).toBeTruthy(); }); });Es bastante básico hasta ahora, solo estoy tratando de obtener lo mínimo para pasar.