All files / tools/ReFlex.TrackingServer/ClientApp/src/app/log log.component.test-context.ts

100% Statements 18/18
100% Branches 0/0
100% Functions 5/5
100% Lines 17/17

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 491x           1x 1x 1x 1x             7x 7x                               3x 7x 7x 7x     3x 7x 7x 7x   7x 7x      
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FormsModule } from '@angular/forms';
import {
  MockValueSelectionComponent,
  ValueSelectionComponent
} from '@reflex/angular-components/dist';
import { of } from 'rxjs';
import { LogComponent } from './log.component';
import { logService } from './log.component.test-data';
import { LogService } from './log.service';
 
export let component: LogComponent;
 
export let fixture: ComponentFixture<LogComponent>;
 
export function setupTests(): void {
  beforeEach(async () => {
    await TestBed.configureTestingModule({
      imports: [FormsModule, LogComponent],
      providers: [
        {
          provide: LogService,
          useValue: logService
        }
      ]
    })
      .overrideComponent(LogComponent, {
        remove: { imports: [ValueSelectionComponent] },
        add: { imports: [MockValueSelectionComponent] }
      })
      .compileComponents();
  });
 
  beforeEach(() => {
    fixture = TestBed.createComponent(LogComponent);
    component = fixture.componentInstance;
    logService.getLogs.mockReturnValue(of());
  });
 
  afterEach(() => {
    logService.getLogs.mockClear();
    logService.reset.mockClear();
    logService.sendErrorLog.mockClear();
 
    component.filterLevel = -1;
    component.messages = [];
  });
}