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/components/network/SoftwareProductComponentsNetworkList.js';
20 import SoftwareProductComponentsNetworkListView from 'sdc-app/onboarding/softwareProduct/components/network/SoftwareProductComponentsNetworkListView.jsx';
22 import {SoftwareProductFactory} from 'test-utils/factories/softwareProduct/SoftwareProductFactory.js';
23 import {VSPEditorFactory} from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js';
24 import {VSPComponentsNicWithIdFactory, VSPComponentsVersionControllerFactory} from 'test-utils/factories/softwareProduct/SoftwareProductComponentsNetworkFactories.js';
26 describe('Software Product Component Network Mapper and View Classes', () => {
28 it('mapStateToProps mapper exists', () => {
29 expect(mapStateToProps).toBeTruthy();
32 it('mapStateToProps data test', () => {
34 const currentSoftwareProduct = VSPEditorFactory.build();
38 softwareProduct: SoftwareProductFactory.build({
39 softwareProductEditor: {
40 data: currentSoftwareProduct
42 softwareProductComponents: {
47 qgenericFieldInfo: {},
59 var results = mapStateToProps(obj);
60 expect(results.qdata).toBeTruthy();
61 expect(results.dataMap).toBeTruthy();
62 expect(results.qgenericFieldInfo).toBeTruthy();
63 expect(results.componentData).toBeTruthy();
66 it('Software Product Component Network List View Test', () => {
68 const currentSoftwareProduct = VSPEditorFactory.build();
70 const versionControllerData = VSPComponentsVersionControllerFactory.build();
72 const nicList = VSPComponentsNicWithIdFactory.buildList(1);
74 var renderer = TestUtils.createRenderer();
76 <SoftwareProductComponentsNetworkListView
77 versionControllerData={versionControllerData}
78 currentSoftwareProduct={currentSoftwareProduct}
79 softwareProductId='123'
82 var renderedOutput = renderer.getRenderOutput();
83 expect(renderedOutput).toBeTruthy();