2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 import expect from 'expect';
22 import React from 'react';
23 import TestUtils from 'react-addons-test-utils';
24 import {mapStateToProps} from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js';
26 import SoftwareProductAttachmentsView from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx';
27 import {statusEnum as versionStatusEnum} from 'nfvo-components/panel/versionController/VersionControllerConstants.js';
30 describe('SoftwareProductAttachments Modal Mapper and View Classes', () => {
32 it ('mapStateToProps mapper exists', () => {
33 expect(mapStateToProps).toExist();
37 it ('mapStateToProps check data', () => {
39 const currentSoftwareProduct = {
43 vendorId: '97B3E2525E0640ACACF87CE6B3753E80',
44 category: 'resourceNewCategory.application l4+',
45 subCategory: 'resourceNewCategory.application l4+.database',
46 id: 'D4774719D085414E9D5642D1ACD59D20',
48 viewableVersions: ['0.1', '0.2'],
49 status: versionStatusEnum.CHECK_OUT_STATUS,
60 'name': 'heat_zxeyCtMHhf2.yaml',
66 'message': 'Resource is not defined as output and thus cannot be Shared. resource id - network_4'
71 'name': 'heat_env_zxeyCtMHhf2.env',
82 'errorLevel': 'WARNING',
83 'errorMessage': 'Resource is not defined as output and thus cannot be Shared. resource id - network_4',
84 'name': 'heat_zxeyCtMHhf2.yaml',
90 'errorLevel': 'WARNING',
91 'errorMessage': 'Resource is not defined as output and thus cannot be Shared. resource id - network_3',
92 'name': 'heat_zxeyCtMHhf2.yaml',
101 softwareProductEditor: {
102 data:currentSoftwareProduct
103 }, softwareProductAttachments:
105 attachmentsTree: atTree,
111 var results = mapStateToProps(obj);
112 expect(results.attachmentsTree).toExist();
113 expect(results.errorList).toExist();
114 expect(results.hoveredNode).toBe(undefined);
115 expect(results.selectedNode).toBe(undefined);
119 it('function does exist', () => {
121 const currentSoftwareProduct = {
125 vendorId: '97B3E2525E0640ACACF87CE6B3753E80',
126 category: 'resourceNewCategory.application l4+',
127 subCategory: 'resourceNewCategory.application l4+.database',
128 id: 'D4774719D085414E9D5642D1ACD59D20',
130 viewableVersions: ['0.1', '0.2'],
131 status: versionStatusEnum.CHECK_OUT_STATUS,
132 lockingUser: 'cs0008'
134 const versionControllerData = {
135 version: currentSoftwareProduct.version,
136 viewableVersions:currentSoftwareProduct.viewableVersions,
137 status: currentSoftwareProduct.status,
148 'name': 'heat_zxeyCtMHhf2.yaml',
154 'message': 'Resource is not defined as output and thus cannot be Shared. resource id - network_4'
159 'name': 'heat_env_zxeyCtMHhf2.env',
170 'errorLevel': 'WARNING',
171 'errorMessage': 'Resource is not defined as output and thus cannot be Shared. resource id - network_4',
172 'name': 'heat_zxeyCtMHhf2.yaml',
174 'parentName': 'HEAT',
178 'errorLevel': 'WARNING',
179 'errorMessage': 'Resource is not defined as output and thus cannot be Shared. resource id - network_3',
180 'name': 'heat_zxeyCtMHhf2.yaml',
182 'parentName': 'HEAT',
188 var renderer = TestUtils.createRenderer();
189 renderer.render(<SoftwareProductAttachmentsView
190 versionControllerData={versionControllerData}
191 currentSoftwareProduct={currentSoftwareProduct}
192 attachmentsTree={atTree}
193 errorList={errorList}/>);
194 var renderedOutput = renderer.getRenderOutput();
195 expect(renderedOutput).toExist();