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 React from 'react';
18 import TestUtils from 'react-addons-test-utils';
19 import {mapStateToProps} from 'sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidation.js';
21 import HeatValidationView from 'sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationView.jsx';
22 import {statusEnum as versionStatusEnum} from 'nfvo-components/panel/versionController/VersionControllerConstants.js';
25 describe('SoftwareProductAttachments Modal Mapper and View Classes', () => {
27 it ('mapStateToProps mapper exists', () => {
28 expect(mapStateToProps).toBeTruthy();
32 it ('mapStateToProps check data', () => {
34 const currentSoftwareProduct = {
38 vendorId: '97B3E2525E0640ACACF87CE6B3753E80',
39 category: 'resourceNewCategory.application l4+',
40 subCategory: 'resourceNewCategory.application l4+.database',
41 id: 'D4774719D085414E9D5642D1ACD59D20',
43 viewableVersions: ['0.1', '0.2'],
44 status: versionStatusEnum.CHECK_OUT_STATUS,
55 'name': 'heat_zxeyCtMHhf2.yaml',
61 'message': 'Resource is not defined as output and thus cannot be Shared. resource id - network_4'
66 'name': 'heat_env_zxeyCtMHhf2.env',
77 'errorLevel': 'WARNING',
78 'errorMessage': 'Resource is not defined as output and thus cannot be Shared. resource id - network_4',
79 'name': 'heat_zxeyCtMHhf2.yaml',
85 'errorLevel': 'WARNING',
86 'errorMessage': 'Resource is not defined as output and thus cannot be Shared. resource id - network_3',
87 'name': 'heat_zxeyCtMHhf2.yaml',
96 softwareProductEditor: {
97 data:currentSoftwareProduct
98 }, softwareProductAttachments:
101 attachmentsTree: atTree,
108 var results = mapStateToProps(obj);
109 expect(results.attachmentsTree).toBeTruthy();
110 expect(results.errorList).toBeTruthy();
111 expect(results.currentErrors).toBeTruthy();
112 expect(results.currentWarnings).toBeTruthy();
113 expect(results.selectedNode).toBe(undefined);
117 it('function does exist', () => {
127 'name': 'heat_zxeyCtMHhf2.yaml',
133 'message': 'Resource is not defined as output and thus cannot be Shared. resource id - network_4'
138 'name': 'heat_env_zxeyCtMHhf2.env',
149 'errorLevel': 'WARNING',
150 'errorMessage': 'Resource is not defined as output and thus cannot be Shared. resource id - network_4',
151 'name': 'heat_zxeyCtMHhf2.yaml',
153 'parentName': 'HEAT',
157 'errorLevel': 'WARNING',
158 'errorMessage': 'Resource is not defined as output and thus cannot be Shared. resource id - network_3',
159 'name': 'heat_zxeyCtMHhf2.yaml',
161 'parentName': 'HEAT',
165 var currentErrors = [];
166 var currentWarnings = [];
167 var onSelect = () => { return null; } ;
168 var onDeSelect = () => { return null; } ;
169 var onToggle = () => { return null; } ;
171 var renderer = TestUtils.createRenderer();
172 renderer.render(<HeatValidationView
173 attachmentsTree={atTree}
174 errorList={errorList}
175 currentWarnings={currentWarnings}
176 currentErrors={currentErrors}
177 onSelectNode={onSelect}
178 onDeselectNode={onDeSelect}
179 toggleExpanded = {onToggle} />);
180 var renderedOutput = renderer.getRenderOutput();
181 expect(renderedOutput).toBeTruthy();