ReferenceError: Google не определена свойства ошибки: Object ({ngDebugContext: DebugContext_ - PullRequest
0 голосов
/ 24 апреля 2020

Angular Ошибка модульного тестирования. Я использовал модуль ngx-place-autocomplete enter image description here, он выдает ошибку в моем модульном тестировании.

свойства ошибки: Object ({ngDebugContext: DebugContext _ ({view: Object ({def: Object) ({factory: Function, nodeFlags: 20987907, rootNodeFlags: 16777217, nodeMatchedQueries: 2, флаги: 0, узлы: [Object ({nodeIndex: 0, parent: null, renderParent: null, bindingIndex: 0, outputIndex: 0, checkIndex: 0 0, флаги: 1, childFlags: 16387, directChildFlags: 1, childMatchedQueries: 0, matchedQueries: Object ({}), matchedQueryIds: 0, ссылки: Object ({}), ngContentIndex: null, childCount: 24, привязки: [] , bindingFlags: 0, выходные данные: [], элемент: Object ({ns: '', name: 'div', attrs: [Array], template: null, componentProvider: null, componentView: null, componentRendererType: null, publicProviders: null ({}), allProviders: null ({}), handleEvent: Function}), поставщик: null, текст: null, запрос: null, ngContent: null}), Object ({nodeIndex: 1, parent: Object ({ nodeIndex: 0, родитель: null, renderPar ent: null, bindingIndex: 0, outputIndex: 0, checkIndex: 0, флаги: 1, childFlags: 16387, directChildFlags: 1, ch ... at

projects.component.spe c .ts


import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA ,CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';

import { AllProjectsComponent } from './all-projects.component';
import { RouterTestingModule } from '@angular/router/testing';
import { ProjectsService } from './../../../../services/projects/projects.service';
import { GooglePlaceModule } from 'ngx-google-places-autocomplete';
import { ProjectObject } from './../../../../models/project.model';
import { MockProjectService } from './../../../../mock/mockProject.service';



describe('AllProjectsComponent', () => {
  let component: AllProjectsComponent;
  let fixture: ComponentFixture<AllProjectsComponent>;
  let service : ProjectsService;
  let response;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ AllProjectsComponent ],
      imports: [  RouterTestingModule, GooglePlaceModule ],
      providers: [
        {
          provide: ProjectsService,
          useClass: MockProjectService
        },],
      schemas: [ NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(AllProjectsComponent);
    component = fixture.componentInstance;
    service = TestBed.get(ProjectsService);
    response = {

      project: {
          projectType : "public",
          status : "open",
      }    

  } 

    fixture.detectChanges();
  });

  it('should set projects property with the items returned from the server and set loading propert to false', () => {

    component.ngOnInit();
    expect(component.projects).toEqual([response])
  })




});

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...