summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.service.spec.ts
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2019-07-07 19:23:03 +0300
committerIttay Stern <ittay.stern@att.com>2019-07-08 16:13:43 +0300
commitf792671ae247a931f34d902e9276202b5016ef9a (patch)
tree6104971e8074c9a3d720836276ff18619719ec02 /vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.service.spec.ts
parentfc62274e8d15964d63c62bf0e2f4abc040252ee9 (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/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.ts67
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));
+ });
+
});