diff options
author | Ittay Stern <ittay.stern@att.com> | 2018-08-29 17:01:32 +0300 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2019-02-18 18:35:30 +0200 |
commit | 6f900cc45d7dd7f97430812b86b5c1d1693c8ae3 (patch) | |
tree | 936005c364dc5a7264d6304d4777c3d83494db22 /vid-webpack-master/src/app/shared/components/spinner/spinner.component.spec.ts | |
parent | 67d99f816cc583643c35193197594cf78d8ce60a (diff) |
merge from ecomp a88f0072 - Modern UI
Issue-ID: VID-378
Change-Id: Ibcb23dd27f550cf32ce2fe0239f0f496ae014ff6
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/spinner/spinner.component.spec.ts')
-rw-r--r-- | vid-webpack-master/src/app/shared/components/spinner/spinner.component.spec.ts | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/vid-webpack-master/src/app/shared/components/spinner/spinner.component.spec.ts b/vid-webpack-master/src/app/shared/components/spinner/spinner.component.spec.ts index 531ee8c62..57f7b009c 100644 --- a/vid-webpack-master/src/app/shared/components/spinner/spinner.component.spec.ts +++ b/vid-webpack-master/src/app/shared/components/spinner/spinner.component.spec.ts @@ -1,42 +1,50 @@ -import {async, ComponentFixture, TestBed} from '@angular/core/testing'; +import {ComponentFixture, TestBed} from '@angular/core/testing'; import {HttpClientTestingModule} from '@angular/common/http/testing'; -import { SpinnerComponent } from './spinner.component'; +import {SpinnerComponent, SpinnerInfo} from './spinner.component'; +import {CUSTOM_ELEMENTS_SCHEMA} from "@angular/core"; describe('Spinner component', () => { let component: SpinnerComponent; let fixture: ComponentFixture<SpinnerComponent>; - beforeEach(async(() => { + beforeAll(done => (async () => { TestBed.configureTestingModule({ imports: [HttpClientTestingModule], providers: [], - declarations: [SpinnerComponent ] - }) - .compileComponents(); - })); + declarations: [SpinnerComponent], + schemas: [ CUSTOM_ELEMENTS_SCHEMA ] + }); + await TestBed.compileComponents(); - beforeEach(() => { fixture = TestBed.createComponent(SpinnerComponent); component = fixture.componentInstance; fixture.detectChanges(); - }); - it('component should be defined', () => { + })().then(done).catch(done.fail)); + + + + test('component should be defined', () => { expect(component).toBeDefined(); }); - - it('component constructor should subscribe of showSpinner event with true', ()=> { - SpinnerComponent.showSpinner.next(true); + test('component constructor should subscribe of showSpinner event with true', ()=> { + let spinnerInfo : SpinnerInfo = new SpinnerInfo(true, 'someUrl', 'json'); + SpinnerComponent.showSpinner.next(spinnerInfo); expect(component.show).toBeTruthy(); }); - it('component constructor should subscribe of showSpinner event with false', ()=> { - SpinnerComponent.showSpinner.next(false); + test('component constructor should subscribe of showSpinner event with true and then to be false', ()=> { + let spinnerInfo : SpinnerInfo = new SpinnerInfo(true, 'someUrl', 'json'); + SpinnerComponent.showSpinner.next(spinnerInfo); + spinnerInfo = new SpinnerInfo(false, 'someUrl', 'json'); + SpinnerComponent.showSpinner.next(spinnerInfo); expect(component.show).toBeFalsy(); }); - - - + test('component constructor should subscribe of showSpinner event with false', ()=> { + let spinnerInfo : SpinnerInfo = new SpinnerInfo(false, 'someUrl', 'json'); + SpinnerComponent.showSpinner.next(spinnerInfo); + expect(component.show).toBeFalsy(); + }); }); |