summaryrefslogtreecommitdiffstats
path: root/openecomp-ui
diff options
context:
space:
mode:
authorTomasz Pietruszkiewicz <tomasz.pietruszkiewicz@nokia.com>2021-01-21 10:56:15 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2021-01-21 15:20:28 +0000
commit32111c9725557d556a73929898264b4b338bb3d6 (patch)
tree2e985436a47e6a3aba79ba32f18af2d677612d00 /openecomp-ui
parent5c5d4e5aa06d7fd4618caf19279ce5a6efb26ce8 (diff)
Fix empty file list after import service CSAR in VSP
Change-Id: Id8e7cb7b71d4cd8d852946b6ff365054e551c005 Issue-ID: SDC-3438 Signed-off-by: Tomasz Pietruszkiewicz <tomasz.pietruszkiewicz@nokia.com>
Diffstat (limited to 'openecomp-ui')
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js7
-rw-r--r--openecomp-ui/test/softwareProduct/attachments/validation/HeatValidationActionHelper.test.js53
2 files changed, 57 insertions, 3 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js
index f02953857b..a34dfe7b04 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js
@@ -139,9 +139,10 @@ const mapValidationDataToTree = (validationData, packageName) => {
type: 'heat',
header: true,
errors: errors,
- children: heat
- ? heat.map(mapHeatData)
- : nested ? nested.map(mapHeatData) : []
+ children:
+ heat && heat.length
+ ? heat.map(mapHeatData)
+ : nested ? nested.map(mapHeatData) : []
},
...(artifacts
? [
diff --git a/openecomp-ui/test/softwareProduct/attachments/validation/HeatValidationActionHelper.test.js b/openecomp-ui/test/softwareProduct/attachments/validation/HeatValidationActionHelper.test.js
index d8a5d1fad6..73eb2560be 100644
--- a/openecomp-ui/test/softwareProduct/attachments/validation/HeatValidationActionHelper.test.js
+++ b/openecomp-ui/test/softwareProduct/attachments/validation/HeatValidationActionHelper.test.js
@@ -82,6 +82,59 @@ describe('HeatValidationActionHelper ActionHelper', () => {
expect(store.getState().softwareProduct.softwareProductAttachments.heatValidation.attachmentsTree.children[0].expanded).toBe(false);
});
+ it('should get values from nested object if heat object is empty', () => {
+ const validationData = {
+ importStructure: {
+ heat: [],
+ nested: [
+ {
+ fileName: 'hot-mog-0108-bs1271.yml',
+ env: {
+ fileName: 'hot-mog-0108-bs1271.env'
+ },
+ errors: [
+ {
+ 'level': 'WARNING',
+ 'message': 'Port not bind to any NOVA Server, Resource Id [sm02_port_2]'
+ },
+ {
+ 'level': 'WARNING',
+ 'message': 'Port not bind to any NOVA Server, Resource Id [sm01_port_2]'
+ }
+ ]
+ }
+ ]
+ }
+ };
+
+ const currentSoftwareProduct = {
+ name: 'VSp',
+ description: 'dfdf',
+ vendorName: 'V1',
+ vendorId: '97B3E2525E0640ACACF87CE6B3753E80',
+ category: 'resourceNewCategory.application l4+',
+ subCategory: 'resourceNewCategory.application l4+.database',
+ id: 'D4774719D085414E9D5642D1ACD59D20',
+ version: '0.10',
+ viewableVersions: ['0.1', '0.2'],
+ status: 'Locked',
+ lockingUser: 'cs0008',
+ validationData
+ };
+
+
+ const store = storeCreator();
+ deepFreeze(store.getState());
+ deepFreeze(currentSoftwareProduct);
+
+ store.dispatch({
+ type:actionTypes.SOFTWARE_PRODUCT_LOADED,
+ response: currentSoftwareProduct
+ });
+
+ expect(store.getState().softwareProduct.softwareProductAttachments.heatValidation.attachmentsTree.children[0].children.length).toBe(1);
+ });
+
it('onSelectNode & onUnselectNode function check', () => {