From f792671ae247a931f34d902e9276202b5016ef9a Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Sun, 7 Jul 2019 19:23:03 +0300 Subject: Merge from ecomp 718fd196 - Modern UI Issue-ID: VID-378 Change-Id: I2736b98426e324ec3aa233b034229ba84d99839f Signed-off-by: Ittay Stern --- .../model-information.service.spec.ts | 32 +++++++++++++++++----- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'vid-webpack-master/src/app/shared/components/model-information/model-information.service.spec.ts') 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); }); + }); -- cgit 1.2.3-korg