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 ShallowRenderer from 'react-test-renderer/shallow';
19 import TestUtils from 'react-dom/test-utils';
20 import {mapStateToProps} from 'sdc-app/onboarding/softwareProduct/components/network/SoftwareProductComponentsNICEditor.js';
21 import SoftwareProductComponentsNICEditorView from 'sdc-app/onboarding/softwareProduct/components/network/SoftwareProductComponentsNICEditorView.jsx';
23 import {VSPEditorFactory} from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js';
24 import {SoftwareProductFactory} from 'test-utils/factories/softwareProduct/SoftwareProductFactory.js';
25 import {VSPComponentsNicFactory, VSPComponentsNetworkQDataFactory, VSPComponentsNicFactoryQGenericFieldInfo,
26 VSPComponentsNicFactoryGenericFieldInfo, VSPComponentsNetworkDataMapFactory} from 'test-utils/factories/softwareProduct/SoftwareProductComponentsNetworkFactories.js';
27 import CurrentScreenFactory from 'test-utils/factories/common/CurrentScreenFactory.js';
30 describe('Software Product Component Network NIC Editor and View Classes', () => {
31 it('mapStateToProps mapper exists', () => {
32 expect(mapStateToProps).toBeTruthy();
36 it('mapStateToProps data test', () => {
38 const currentSoftwareProduct = VSPEditorFactory.build();
41 currentScreen: CurrentScreenFactory.build(),
42 softwareProduct: SoftwareProductFactory.build({
43 softwareProductEditor: {
44 data: currentSoftwareProduct
46 softwareProductComponents: {
52 qgenericFieldInfo: {},
60 var results = mapStateToProps(obj);
61 expect(results.isReadOnlyMode).toBe(false);
62 expect(results.currentSoftwareProduct).toBeTruthy();
63 expect(results.qdata).toBeTruthy();
64 expect(results.dataMap).toBeTruthy();
65 expect(results.genericFieldInfo).toBeTruthy();
66 expect(results.qgenericFieldInfo).toBeTruthy();
67 expect(results.data).toBeTruthy();
72 it('Software Product Component Network NIC Editor View Test', () => {
75 data: VSPComponentsNicFactory.build(),
76 qdata: VSPComponentsNetworkQDataFactory.build(),
77 dataMap: VSPComponentsNetworkDataMapFactory.build(),
78 genericFieldInfo: VSPComponentsNicFactoryGenericFieldInfo.build(),
79 qgenericFieldInfo: VSPComponentsNicFactoryQGenericFieldInfo.build(),
85 const renderer = new ShallowRenderer();
86 renderer.render(<SoftwareProductComponentsNICEditorView {...props}/>);
87 var renderedOutput = renderer.getRenderOutput();
88 expect(renderedOutput).toBeTruthy();