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

import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatTableModule } from '@angular/material/table';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { BCI_SHARED_INTL_PROVIDER, BciSharedModule, ConsoleLoggerService, CORE_CONFIG, CoreConfig, LoggerService } from '@bci-web-core/core';
import { LoggerTableComponent } from './logger-table.component';

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

  beforeEach(
    waitForAsync(() => {
      TestBed.configureTestingModule({
        imports: [BciSharedModule, MatTableModule, MatPaginatorModule, NoopAnimationsModule],
        providers: [
          { provide: CORE_CONFIG, useValue: <CoreConfig>{ environment: 'test', endpointNavigation: 'nix' } },
          { provide: LoggerService, useClass: ConsoleLoggerService },
          BCI_SHARED_INTL_PROVIDER
        ],
        declarations: [LoggerTableComponent],
      }).compileComponents();
    })
  );

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

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

  it('should contain data on entry on logError', () => {
    component.logError();
    fixture.detectChanges();
    expect(component.data.length).toBe(1);
  });
});
