diff options
author | Ittay Stern <ittay.stern@att.com> | 2019-07-07 19:23:03 +0300 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2019-07-08 16:13:43 +0300 |
commit | f792671ae247a931f34d902e9276202b5016ef9a (patch) | |
tree | 6104971e8074c9a3d720836276ff18619719ec02 /vid-webpack-master/src/app/shared/components/model-information | |
parent | fc62274e8d15964d63c62bf0e2f4abc040252ee9 (diff) |
Merge from ecomp 718fd196 - Modern UI
Issue-ID: VID-378
Change-Id: I2736b98426e324ec3aa233b034229ba84d99839f
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/model-information')
-rw-r--r-- | vid-webpack-master/src/app/shared/components/model-information/model-information.service.spec.ts | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/vid-webpack-master/src/app/shared/components/model-information/model-information.service.spec.ts b/vid-webpack-master/src/app/shared/components/model-information/model-information.service.spec.ts index 418493f2b..3d80cffab 100644 --- a/vid-webpack-master/src/app/shared/components/model-information/model-information.service.spec.ts +++ b/vid-webpack-master/src/app/shared/components/model-information/model-information.service.spec.ts @@ -1,15 +1,32 @@ import {ModelInformationService} from "./model-information.service"; import {ModelInformationItem} from "./model-information.component"; +import {HttpClientTestingModule, HttpTestingController} from "@angular/common/http/testing"; +import {getTestBed, TestBed} from "@angular/core/testing"; describe('ModelInformationService', () => { - let underTest:ModelInformationService; + let injector; + let service: ModelInformationService; + let httpMock: HttpTestingController; + + + beforeAll(done => (async () => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [ + ModelInformationService + ] + }); + await TestBed.compileComponents(); + + injector = getTestBed(); + service = injector.get(ModelInformationService); + httpMock = injector.get(HttpTestingController); + + })().then(done).catch(done.fail)); - beforeEach(() => { - underTest = new ModelInformationService(); - }); test('when call to filterModelItems then items with empty values are filtered', () =>{ - expect(underTest.filterModelItems([ + expect(service.filterModelItems([ ModelInformationItem.createInstance("emptyValue", ""), ModelInformationItem.createInstance("nullValue", null), ModelInformationItem.createInstance("undefinedValue", undefined), @@ -20,13 +37,14 @@ describe('ModelInformationService', () => { test('when call to filterModelItems then mandatory items with empty values are not filtered', () =>{ const mandatoryItem:ModelInformationItem = new ModelInformationItem("a", "b", [""], "c", true); - expect(underTest.filterModelItems([mandatoryItem])).toEqual([mandatoryItem]); + expect(service.filterModelItems([mandatoryItem])).toEqual([mandatoryItem]); }); test('when call to filterModelItems then items with values are not filtered', () =>{ - expect(underTest.filterModelItems([ + expect(service.filterModelItems([ ModelInformationItem.createInstance("withString", "a"), ModelInformationItem.createInstance("withNumber", 1), ])).toHaveLength(2); }); + }); |