diff options
author | 2019-07-09 14:23:37 +0000 | |
---|---|---|
committer | 2019-07-09 14:23:37 +0000 | |
commit | 58d22b526418ffeb89337fed9e20406da420bc6f (patch) | |
tree | 4357c9cfe1c92d57ac0a3f90167cade7af505b95 /vid-webpack-master/src/app/shared/components/model-information/model-information.service.spec.ts | |
parent | 302b02a847e7aa8ccf3ff4bc14ff8a9cf67511b0 (diff) | |
parent | 97d9f66df456ef4573047a90baa3cc3ee4bfb0b7 (diff) |
Merge changes Ib4430bf2,Icc0bdb9e,I2736b984
* changes:
Merge from ecomp 718fd196 - Ext. Services Simulator
Merge from ecomp 718fd196 - Integration Tests
Merge from ecomp 718fd196 - Modern UI
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/model-information/model-information.service.spec.ts')
-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); }); + }); |