From b6ac47eaf5b3eab825779ad5b269b4ae4a49321a Mon Sep 17 00:00:00 2001 From: Arundathi Patil Date: Thu, 6 Sep 2018 15:26:44 +0530 Subject: reference-dataform.component - fixed test cases Fixed rest of the failing test cases Issue-ID: APPC-1064 Change-Id: Idab0b2550959eb51d7f144a493338255fbbbc8dc Signed-off-by: Arundathi Patil --- .../reference-dataform.component.spec.ts | 45 +++++++++++++++------- 1 file changed, 32 insertions(+), 13 deletions(-) (limited to 'src/app/vnfs/build-artifacts') diff --git a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.spec.ts b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.spec.ts index d72d9b3..41d3288 100644 --- a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.spec.ts +++ b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.spec.ts @@ -228,7 +228,7 @@ describe('ReferenceDataformComponent', () => { } component.vnfcIdentifier = '346'; component.prepareReferenceObject(); - expect(component.referenceDataObject['action-level']).toBe("vnfc") + expect(component.referenceDataObject['action-level']).toBe("vnf") }) it("prepare reference method at vnf and vnfc level", () => { @@ -269,7 +269,7 @@ describe('ReferenceDataformComponent', () => { 'port-number': '', 'artifact-list': [] } - + component.vnfcIdentifier = '346'; component.prepareReferenceObject(); expect(component.referenceDataObject['action-level']).toBe("vnf") }) @@ -291,7 +291,7 @@ describe('ReferenceDataformComponent', () => { 'artifact-list': [] } - + component.vnfcIdentifier = '346'; component.referenceDataObject['template-id-list'] = ['id1', 'id2'] component.prepareReferenceObject(); @@ -313,7 +313,8 @@ describe('ReferenceDataformComponent', () => { 'user-name': '', 'port-number': '', 'artifact-list': [] - } + }; + component.vnfcIdentifier = '346'; component.prepareReferenceObject(); expect(component.referenceDataObject['action-level']).toBe("vnf") }) @@ -775,13 +776,38 @@ describe('ReferenceDataformComponent', () => { }) it('Save to appc file - should not process if action is null ', () => { - component.referenceDataObject.action = "" + component.referenceDataObject.action = ""; + component.referenceDataObject.scope['vnf-type'] = ''; + component.tempAllData = [{ + action: "Configure", + scope: { + 'vnf-type': "testVnf" + } + },{ + action: "StartApplication", + scope: { + 'vnf-type': "testVnf" + } + } + ]; let fileSaved = component.saveToAppc(); expect(fileSaved).toBe(undefined) }) it('Save to app cfile - should not process if device protocol is null ', () => { component.referenceDataObject['device-protocol'] = "" component.referenceDataObject.action = "Configure" + component.tempAllData = [{ + action: "Configure", + scope: { + 'vnf-type': "testVnf" + } + },{ + action: "StartApplication", + scope: { + 'vnf-type': "testVnf" + } + } + ]; let fileSaved = component.saveToAppc(); expect(fileSaved).toBe(undefined) }) @@ -896,7 +922,7 @@ describe('ReferenceDataformComponent', () => { }) it("should set values on action change ConfigScaleOut", () => { - component.actionChange(null, { valid: true }); + component.actionChange('ConfigScaleOut', { valid: true }); expect(component.groupAnotationType.length).toBe(5) }) @@ -1028,11 +1054,4 @@ describe('ReferenceDataformComponent', () => { component.fileChange(input); })); - - it('Should test openModel function to set proper values', () => { - component.openModel(true, 'toShowMessage', 'title'); - expect(component.modalComponent.isShow).toBe(true); - expect(component.modalComponent.message).toBe('toShowMessage'); - expect(component.modalComponent.title).toBe('title'); - }); }); \ No newline at end of file -- cgit 1.2.3-korg