2 * Copyright © 2016-2017 European Support Limited
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 or implied.
13 * See the License for the specific language governing permissions and
14 * 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/networks/SoftwareProductNetworks.js';
20 import SoftwareProductNetworksView from 'sdc-app/onboarding/softwareProduct/networks/SoftwareProductNetworksView.jsx';
21 //import {statusEnum as versionStatusEnum} from 'nfvo-components/panel/versionController/VersionControllerConstants.js';
23 import VSPNetworkFactory from 'test-utils/factories/softwareProduct/SoftwareProductNetworkFactory.js';
24 import {VSPEditorFactory} from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js';
25 import {VSPComponentsVersionControllerFactory} from 'test-utils/factories/softwareProduct/SoftwareProductComponentsNetworkFactories.js';
27 describe('SoftwareProductNetworks Mapper and View Classes', () => {
28 it ('mapStateToProps mapper exists', () => {
29 expect(mapStateToProps).toBeTruthy();
32 it ('mapStateToProps data test', () => {
34 const currentSoftwareProduct = VSPEditorFactory.build();
36 const networksList = VSPNetworkFactory.buildList(2);
40 softwareProductEditor: {
41 data:currentSoftwareProduct
43 softwareProductNetworks:
49 var results = mapStateToProps(obj);
50 expect(results.networksList).toBeTruthy();
53 it ('view simple test', () => {
55 const currentSoftwareProduct = VSPEditorFactory.build();
57 const networksList = VSPNetworkFactory.buildList(2);
59 const versionControllerData = VSPComponentsVersionControllerFactory.build();
60 var renderer = TestUtils.createRenderer();
61 renderer.render(<SoftwareProductNetworksView isReadOnlyMode={true} networksList={networksList} versionControllerData={versionControllerData} currentSoftwareProduct={currentSoftwareProduct}/>);
62 var renderedOutput = renderer.getRenderOutput();
63 expect(renderedOutput).toBeTruthy();