loader service show hide unit test angular

Solutions on MaxInterview for loader service show hide unit test angular by the best coders in the world

showing results for - "loader service show hide unit test angular"
María Paula
05 Feb 2019
1import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2import { SpinnerComponent } from './spinner.component';
3import { of } from 'rxjs/observable/of';
4
5describe('SpinnerComponent', () => {
6  let component: SpinnerComponent;
7  let fixture: ComponentFixture<SpinnerComponent>;
8  const fakeSpinner = {
9    spinnerState: of({ show: false }),
10  };
11
12  beforeEach(
13    async(() => {
14      TestBed.configureTestingModule({
15        declarations: [SpinnerComponent],
16        providers: [{ provide: SpinnerService, useValue: fakeSpinner }],
17      }).compileComponents();
18    }),
19  );
20
21  beforeEach(() => {
22    fixture = TestBed.createComponent(SpinnerComponent);
23    component = fixture.componentInstance;
24    fixture.detectChanges();
25  });
26
27  it('should set component.visible based on spinnerService state', () => {
28    expect(component.visible).toEqual(false)
29  });
30});
31