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/drawingBoard/service-planning/drawing-board-header/drawing-board-header.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/drawingBoard/service-planning/drawing-board-header/drawing-board-header.service.spec.ts')
-rw-r--r-- | vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.service.spec.ts | 67 |
1 files changed, 56 insertions, 11 deletions
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.service.spec.ts index bcf6753b9..76fc28a9e 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.service.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.service.spec.ts @@ -85,7 +85,7 @@ describe('Generate path to old View/Edit ', () => { }); test('deployShouldBeDisabled with validationCounter greater then 0',()=>{ - jest.spyOn(store, 'getState').mockReturnValue({ + jest.spyOn(store, 'getState').mockReturnValue(<any>{ service: { serviceInstance : { 'serviceInstanceId' : { @@ -94,12 +94,12 @@ describe('Generate path to old View/Edit ', () => { } } }); - let result = service.deployShouldBeDisabled("serviceInstanceId"); + let result = service.deployShouldBeDisabled("serviceInstanceId", DrawingBoardModes.RETRY_EDIT); expect(result).toBeTruthy(); }); test('deployShouldBeDisabled with validationCounter is 0 and not dirty',()=>{ - jest.spyOn(store, 'getState').mockReturnValue({ + jest.spyOn(store, 'getState').mockReturnValue(<any>{ service: { serviceInstance : { 'serviceInstanceId' : { @@ -109,12 +109,12 @@ describe('Generate path to old View/Edit ', () => { } } }); - let result = service.deployShouldBeDisabled("serviceInstanceId"); + let result = service.deployShouldBeDisabled("serviceInstanceId", DrawingBoardModes.RETRY_EDIT); expect(result).toBeFalsy(); }); test('deployShouldBeDisabled with validationCounter is 0 and dirty',()=>{ - jest.spyOn(store, 'getState').mockReturnValue({ + jest.spyOn(store, 'getState').mockReturnValue(<any>{ service: { serviceInstance : { 'serviceInstanceId' : { @@ -125,12 +125,12 @@ describe('Generate path to old View/Edit ', () => { } } }); - let result = service.deployShouldBeDisabled("serviceInstanceId"); + let result = service.deployShouldBeDisabled("serviceInstanceId", DrawingBoardModes.RETRY_EDIT); expect(result).not.toBeTruthy(); }); test('deployShouldBeDisabled with validationCounter is 0 and not and action is None and dirty',()=>{ - jest.spyOn(store, 'getState').mockReturnValue({ + jest.spyOn(store, 'getState').mockReturnValue(<any>{ service: { serviceInstance : { 'serviceInstanceId' : { @@ -141,7 +141,7 @@ describe('Generate path to old View/Edit ', () => { } } }); - let result = service.deployShouldBeDisabled("serviceInstanceId"); + let result = service.deployShouldBeDisabled("serviceInstanceId", DrawingBoardModes.RETRY_EDIT); expect(result).not.toBeTruthy(); }); @@ -157,8 +157,8 @@ describe('Generate path to old View/Edit ', () => { expect(result).toEqual('REDEPLOY'); }); test('getButtonText',()=>{ - expect(service.getButtonText("VIEW")).toEqual('EDIT'); - expect(service.getButtonText("RETRY")).toEqual('REDEPLOY'); + expect(service.getButtonText(DrawingBoardModes.VIEW)).toEqual('EDIT'); + expect(service.getButtonText(DrawingBoardModes.RETRY)).toEqual('REDEPLOY'); }); const showEditServiceDataProvider = [ @@ -169,7 +169,7 @@ describe('Generate path to old View/Edit ', () => { ['None action EDIT mode',DrawingBoardModes.EDIT, ServiceInstanceActions.None, false], ['None action RETRY_EDIT mode', DrawingBoardModes.RETRY_EDIT, ServiceInstanceActions.None, false]]; each(showEditServiceDataProvider).test('showEditService service with %s', (description, mode, action, enabled) => { - jest.spyOn(store, 'getState').mockReturnValue({ + jest.spyOn(store, 'getState').mockReturnValue(<any>{ service: { serviceInstance : { 'serviceInstanceId' : { @@ -181,4 +181,49 @@ describe('Generate path to old View/Edit ', () => { expect(service.showEditService(mode, 'serviceInstanceId')).toBe(enabled); }); + + const showResumeServiceDataProvider = [ + ['all conditions of resume- should show resume',true, 'MACRO', 'VPE', 'AssiGNed', true], + ['flag is disabled- should not show resume ',false, 'MACRO', 'VPE', 'AssiGNed', false], + ['transport service (PNF)- should not show resume', true, 'Macro', 'transport', 'Assigned', false], + ['instantiationType is a-la-carte- should not show resume', true, 'ALaCarte', 'VPE', 'Assigned', false], + ['orchestration Status is not assigned- should not show resume', true, 'Macro', 'VPE', 'Created', false], + ['orchestration Status is Inventoried - should show resume', true, 'Macro', 'VPE', 'iNventOriEd', true] + ]; + + each(showResumeServiceDataProvider).test('showResumeService when %s', (description, flagResumeMacroService,instantiationType, subscriptionServiceType, orchStatus, shouldShowResumeService) => { + jest.spyOn(store, 'getState').mockReturnValue(<any>{ + global: { + flags:{ + 'FLAG_1908_RESUME_MACRO_SERVICE': flagResumeMacroService + } + }, + service: { + serviceInstance : { + 'serviceModelId' : { + 'vidNotions': { + 'instantiationType': instantiationType + }, + 'subscriptionServiceType':subscriptionServiceType, + 'orchStatus': orchStatus + } + } + } + }); + expect(service.showResumeService('serviceModelId')).toBe(shouldShowResumeService); + + }); + + + const toggleResumeServiceDataProvider = [ + [ServiceInstanceActions.None, true], + [ServiceInstanceActions.Resume, false] + ]; + + each(toggleResumeServiceDataProvider).test('toggleResumeService - should call %s for resume/ undo Resume',(serviceAction, isResume)=>{ + jest.spyOn(store, 'dispatch'); + service.toggleResumeService("serviceInstanceId", isResume); + expect(store.dispatch).toHaveBeenCalledWith(addServiceAction("serviceInstanceId", serviceAction)); + }); + }); |