/*
 * Copyright (C) 2019 Robert Bosch GmbH Copyright (C) 2019 Robert Bosch Manufacturing Solutions GmbH, Germany. All rights reserved.
 */

import { NgModule } from '@angular/core';
import { inject, TestBed } from '@angular/core/testing';
import { MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { of } from 'rxjs';

import { BciSharedIntl } from '../../shared/shared-intl';
import { ModalComponent } from '../modal-window/modal.component';
import { LoadingScreenComponent } from './loading-screen.component';
import { LoadingScreenService } from './loading-screen.service';
import { CommonModule } from '@angular/common';

@NgModule({
  imports: [CommonModule, MatDialogModule, MatProgressBarModule],
  declarations: [ModalComponent, LoadingScreenComponent],
  providers: [
    BciSharedIntl,
    { provide: MAT_DIALOG_DATA, useValue: {} },
    {
      provide: MatDialogRef,
      useValue: {
        _containerInstance: {
          _config: {},
        },
        backdropClick: () => of(''),
        // eslint-disable-next-line no-empty-function
        close: () => {},
      },
    },
  ],
})
class LoadingScreenTestModule {}

describe('LoadingScreenService', () => {
  beforeEach(() => {
    TestBed.configureTestingModule({
      imports: [
        LoadingScreenTestModule, // create a own Module, so we can define entryComponents (@angular/material2 do the same)
      ],
      providers: [LoadingScreenService],
    });
  });

  it('should be created', inject([LoadingScreenService], (service: LoadingScreenService) => {
    expect(service).toBeTruthy();
  }));
});
