2 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
13 * or implied. See the License for the specific language governing
14 * permissions and limitations under the License.
17 import HeatValidationActionHelper from 'sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationActionHelper.js';
18 import {storeCreator} from 'sdc-app/AppStore.js';
19 import deepFreeze from 'deep-freeze';
20 import {actionTypes} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js';
21 import {nodeFilters} from 'sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationConstants.js';
23 describe('HeatValidationActionHelper ActionHelper', () => {
25 it('function does exist', () => {
26 expect(HeatValidationActionHelper).toBeTruthy();
29 it('toggleExpanded function check', () => {
32 const validationData = {
36 fileName: 'hot-mog-0108-bs1271.yml',
38 fileName: 'hot-mog-0108-bs1271.env'
43 'message': 'Port not bind to any NOVA Server, Resource Id [sm02_port_2]'
47 'message': 'Port not bind to any NOVA Server, Resource Id [sm01_port_2]'
55 const currentSoftwareProduct = {
59 vendorId: '97B3E2525E0640ACACF87CE6B3753E80',
60 category: 'resourceNewCategory.application l4+',
61 subCategory: 'resourceNewCategory.application l4+.database',
62 id: 'D4774719D085414E9D5642D1ACD59D20',
64 viewableVersions: ['0.1', '0.2'],
66 lockingUser: 'cs0008',
71 const store = storeCreator();
72 deepFreeze(store.getState());
73 deepFreeze(currentSoftwareProduct);
76 type:actionTypes.SOFTWARE_PRODUCT_LOADED,
77 response: currentSoftwareProduct
80 expect(store.getState().softwareProduct.softwareProductAttachments.heatValidation.attachmentsTree.children[0].expanded).toBe(true);
81 HeatValidationActionHelper.toggleExpanded(store.dispatch, {path:[0]});
82 expect(store.getState().softwareProduct.softwareProductAttachments.heatValidation.attachmentsTree.children[0].expanded).toBe(false);
85 it('onSelectNode & onUnselectNode function check', () => {
88 const validationData = {
92 fileName: 'hot-mog-0108-bs1271.yml',
94 fileName: 'hot-mog-0108-bs1271.env'
99 'message': 'Port not bind to any NOVA Server, Resource Id [sm02_port_2]'
103 'message': 'Port not bind to any NOVA Server, Resource Id [sm01_port_2]'
111 const currentSoftwareProduct = {
115 vendorId: '97B3E2525E0640ACACF87CE6B3753E80',
116 category: 'resourceNewCategory.application l4+',
117 subCategory: 'resourceNewCategory.application l4+.database',
118 id: 'D4774719D085414E9D5642D1ACD59D20',
120 viewableVersions: ['0.1', '0.2'],
122 lockingUser: 'cs0008',
126 deepFreeze(currentSoftwareProduct);
128 const store = storeCreator();
129 deepFreeze(store.getState());
132 type:actionTypes.SOFTWARE_PRODUCT_LOADED,
133 response: currentSoftwareProduct
135 let expectedNodeName = 'name';
136 expect(store.getState().softwareProduct.softwareProductAttachments.heatValidation.selectedNode).toBe(nodeFilters.ALL);
137 HeatValidationActionHelper.onSelectNode(store.dispatch, {nodeName:expectedNodeName});
138 expect(store.getState().softwareProduct.softwareProductAttachments.heatValidation.selectedNode).toBe(expectedNodeName);
139 HeatValidationActionHelper.onDeselectNode(store.dispatch);
140 expect(store.getState().softwareProduct.softwareProductAttachments.heatValidation.selectedNode).toBe(nodeFilters.ALL);