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

import { UsersComponent } from './users.component';
import {ApiService} from '../services/api.service';
import {LoginService} from '../services/login.service';
import {ModalService} from '@inst-iot/bosch-angular-ui-components';
import {RbCustomInputsModule} from '../rb-custom-inputs/rb-custom-inputs.module';

// TODO

let apiServiceSpy: jasmine.SpyObj<ApiService>;
let modalServiceSpy: jasmine.SpyObj<ModalService>;
let loginServiceSpy: jasmine.SpyObj<LoginService>;


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

  beforeEach(async(() => {
    const apiSpy = jasmine.createSpyObj('ApiService', ['get', 'post', 'put']);
    const modalSpy = jasmine.createSpyObj('ModalService', ['open']);
    const loginSpy = jasmine.createSpyObj('LoginService', ['login', 'canActivate']);

    TestBed.configureTestingModule({
      declarations: [ UsersComponent ],
      imports: [
        RbCustomInputsModule
      ],
      providers: [
        {provide: ApiService, useValue: apiSpy},
        {provide: ModalService, useValue: modalSpy},
        {provide: LoginService, useValue: loginSpy},
      ]
    })
    .compileComponents();

    apiServiceSpy = TestBed.inject(ApiService) as jasmine.SpyObj<ApiService>;
    modalServiceSpy = TestBed.inject(ModalService) as jasmine.SpyObj<ModalService>;
    loginServiceSpy = TestBed.inject(LoginService) as jasmine.SpyObj<LoginService>;
  }));

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

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