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

import { TemplatesComponent } from './templates.component';
import {LoginService} from '../services/login.service';
import {ValidationService} from '../services/validation.service';
import {ApiService} from '../services/api.service';
import {DataService} from '../services/data.service';
import {RbUiComponentsModule} from '@inst-iot/bosch-angular-ui-components';
import {FormsModule} from '@angular/forms';
import {RbCustomInputsModule} from '../rb-custom-inputs/rb-custom-inputs.module';

// TODO

let apiServiceSpy: jasmine.SpyObj<ApiService>;
let validationServiceSpy: jasmine.SpyObj<ValidationService>;
let dataServiceSpy: jasmine.SpyObj<DataService>;

describe('TemplatesComponent', () => {
  let component: TemplatesComponent;
  let fixture: ComponentFixture<TemplatesComponent>;

  beforeEach(async(() => {
    const apiSpy = jasmine.createSpyObj('ApiService', ['post', 'put']);
    const validationSpy = jasmine.createSpyObj('ValidationService', ['string', 'parameterName', 'parameterRange']);
    const dataSpy = jasmine.createSpyObj('DataService', ['load', 'idReload']);

    TestBed.configureTestingModule({
      declarations: [ TemplatesComponent ],
      imports: [
        RbUiComponentsModule,
        RbCustomInputsModule,
        FormsModule
      ],
      providers: [
        {provide: ApiService, useValue: apiSpy},
        {provide: ValidationService, useValue: validationSpy},
        {provide: DataService, useValue: dataSpy}
      ]
    })
    .compileComponents();

    apiServiceSpy = TestBed.inject(ApiService) as jasmine.SpyObj<ApiService>;
    validationServiceSpy = TestBed.inject(ValidationService) as jasmine.SpyObj<ValidationService>;
    dataServiceSpy = TestBed.inject(DataService) as jasmine.SpyObj<DataService>;
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(TemplatesComponent);
    component = fixture.componentInstance;
    component.ngOnInit();
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});
