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';
23 describe('SoftwareProductAttachments Modal Mapper and View Classes', () => {
25 it ('mapStateToProps mapper exists', () => {
26 expect(mapStateToProps).toBeTruthy();
30 it ('mapStateToProps check data', () => {
32 const currentSoftwareProduct = {
36 vendorId: '97B3E2525E0640ACACF87CE6B3753E80',
37 category: 'resourceNewCategory.application l4+',
38 subCategory: 'resourceNewCategory.application l4+.database',
39 id: 'D4774719D085414E9D5642D1ACD59D20',
41 viewableVersions: ['0.1', '0.2'],
52 'name': 'heat_zxeyCtMHhf2.yaml',
58 'message': 'Resource is not defined as output and thus cannot be Shared. resource id - network_4'
63 'name': 'heat_env_zxeyCtMHhf2.env',
74 'errorLevel': 'WARNING',
75 'errorMessage': 'Resource is not defined as output and thus cannot be Shared. resource id - network_4',
76 'name': 'heat_zxeyCtMHhf2.yaml',
82 'errorLevel': 'WARNING',
83 'errorMessage': 'Resource is not defined as output and thus cannot be Shared. resource id - network_3',
84 'name': 'heat_zxeyCtMHhf2.yaml',
93 softwareProductEditor: {
94 data:currentSoftwareProduct
95 }, softwareProductAttachments:
98 attachmentsTree: atTree,
105 var results = mapStateToProps(obj);
106 expect(results.attachmentsTree).toBeTruthy();
107 expect(results.errorList).toBeTruthy();
108 expect(results.currentErrors).toBeTruthy();
109 expect(results.currentWarnings).toBeTruthy();
110 expect(results.selectedNode).toBe(undefined);
114 it('function does exist', () => {
124 'name': 'heat_zxeyCtMHhf2.yaml',
130 'message': 'Resource is not defined as output and thus cannot be Shared. resource id - network_4'
135 'name': 'heat_env_zxeyCtMHhf2.env',
146 'errorLevel': 'WARNING',
147 'errorMessage': 'Resource is not defined as output and thus cannot be Shared. resource id - network_4',
148 'name': 'heat_zxeyCtMHhf2.yaml',
150 'parentName': 'HEAT',
154 'errorLevel': 'WARNING',
155 'errorMessage': 'Resource is not defined as output and thus cannot be Shared. resource id - network_3',
156 'name': 'heat_zxeyCtMHhf2.yaml',
158 'parentName': 'HEAT',
162 var currentErrors = [];
163 var currentWarnings = [];
164 var onSelect = () => { return null; } ;
165 var onDeSelect = () => { return null; } ;
166 var onToggle = () => { return null; } ;
168 var renderer = TestUtils.createRenderer();
169 renderer.render(<HeatValidationView
170 attachmentsTree={atTree}
171 errorList={errorList}
172 currentWarnings={currentWarnings}
173 currentErrors={currentErrors}
174 onSelectNode={onSelect}
175 onDeselectNode={onDeSelect}
176 toggleExpanded = {onToggle} />);
177 var renderedOutput = renderer.getRenderOutput();
178 expect(renderedOutput).toBeTruthy();