Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame^] | 1 | import {async, ComponentFixture, TestBed} from '@angular/core/testing'; |
| 2 | import {HttpClientTestingModule} from '@angular/common/http/testing'; |
| 3 | import { SpinnerComponent } from './spinner.component'; |
| 4 | |
| 5 | describe('Spinner component', () => { |
| 6 | let component: SpinnerComponent; |
| 7 | let fixture: ComponentFixture<SpinnerComponent>; |
| 8 | |
| 9 | beforeEach(async(() => { |
| 10 | TestBed.configureTestingModule({ |
| 11 | imports: [HttpClientTestingModule], |
| 12 | providers: [], |
| 13 | declarations: [SpinnerComponent ] |
| 14 | }) |
| 15 | .compileComponents(); |
| 16 | })); |
| 17 | |
| 18 | beforeEach(() => { |
| 19 | fixture = TestBed.createComponent(SpinnerComponent); |
| 20 | component = fixture.componentInstance; |
| 21 | fixture.detectChanges(); |
| 22 | }); |
| 23 | |
| 24 | it('component should be defined', () => { |
| 25 | expect(component).toBeDefined(); |
| 26 | }); |
| 27 | |
| 28 | |
| 29 | it('component constructor should subscribe of showSpinner event with true', ()=> { |
| 30 | SpinnerComponent.showSpinner.next(true); |
| 31 | expect(component.show).toBeTruthy(); |
| 32 | }); |
| 33 | |
| 34 | it('component constructor should subscribe of showSpinner event with false', ()=> { |
| 35 | SpinnerComponent.showSpinner.next(false); |
| 36 | expect(component.show).toBeFalsy(); |
| 37 | }); |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | }); |