import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SamplesComponent } from './samples.component'; import {ApiService} from '../services/api.service'; import {AutocompleteService} from '../services/autocomplete.service'; import {DataService} from '../services/data.service'; import {LoginService} from '../services/login.service'; import {LocalStorageService} from 'angular-2-local-storage'; import {ModalService} from '@inst-iot/bosch-angular-ui-components'; import {ValidationService} from '../services/validation.service'; // TODO let apiServiceSpy: jasmine.SpyObj; let autocompleteServiceSpy: jasmine.SpyObj; let modalServiceSpy: jasmine.SpyObj; let dataServiceSpy: jasmine.SpyObj; let loginServiceSpy: jasmine.SpyObj; let localStorageServiceSpy: jasmine.SpyObj; let windowServiceSpy: jasmine.SpyObj; describe('SamplesComponent', () => { let component: SamplesComponent; let fixture: ComponentFixture; beforeEach(async(() => { const apiSpy = jasmine.createSpyObj('ApiService', ['post', 'put']); const autocompleteSpy = jasmine.createSpyObj('AutocompleteService', []); const loginSpy = jasmine.createSpyObj('LoginService', ['login', 'canActivate']); const modalSpy = jasmine.createSpyObj('ModalService', ['open']); const dataSpy = jasmine.createSpyObj('DataService', ['load', 'idReload']); const localStorageSpy = jasmine.createSpyObj('LocalStorageService', ['set', 'remove']); const windowSpy = jasmine.createSpyObj('Window', []); TestBed.configureTestingModule({ declarations: [ SamplesComponent ], imports: [ ], providers: [ {provide: ApiService, useValue: apiSpy}, {provide: AutocompleteService, useValue: autocompleteSpy}, {provide: ModalService, useValue: modalSpy}, {provide: DataService, useValue: dataSpy}, {provide: LoginService, useValue: loginSpy}, {provide: LocalStorageService, useValue: localStorageSpy}, {provide: Window, useValue: windowSpy} ] }) .compileComponents(); apiServiceSpy = TestBed.inject(ApiService) as jasmine.SpyObj; autocompleteServiceSpy = TestBed.inject(AutocompleteService) as jasmine.SpyObj; modalServiceSpy = TestBed.inject(ModalService) as jasmine.SpyObj; dataServiceSpy = TestBed.inject(DataService) as jasmine.SpyObj; loginServiceSpy = TestBed.inject(LoginService) as jasmine.SpyObj; localStorageServiceSpy = TestBed.inject(LocalStorageService) as jasmine.SpyObj; windowServiceSpy = TestBed.inject(Window) as jasmine.SpyObj; })); beforeEach(() => { fixture = TestBed.createComponent(SamplesComponent); component = fixture.componentInstance; component.ngOnInit(); fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); });