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.
16 import React from 'react';
17 import TestUtils from 'react-addons-test-utils';
18 import {mapStateToProps as computeEditorMapStateToProps} from 'sdc-app/onboarding/softwareProduct/components/compute/computeComponents/computeFlavor/ComputeFlavorEditor.js';
19 import ComputeEditorView from 'sdc-app/onboarding/softwareProduct/components/compute/computeComponents/computeFlavor/ComputeFlavorEditorView.jsx';
21 import {SoftwareProductFactory} from 'test-utils/factories/softwareProduct/SoftwareProductFactory.js';
22 import {VSPEditorFactory} from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js';
23 import {ComputeFlavorBaseData, ComputeFlavorQData, VSPComponentsComputeDataMapFactory} from 'test-utils/factories/softwareProduct/SoftwareProductComponentsComputeFactory.js';
24 import CurrentScreenFactory from 'test-utils/factories/common/CurrentScreenFactory.js';
26 describe('Software Product Component Compute-Editor Mapper and View Classes.', () => {
28 it('Compute Editor - mapStateToProps mapper exists', () => {
29 expect(computeEditorMapStateToProps).toBeTruthy();
32 it('Compute Editor - mapStateToProps data test', () => {
33 const currentSoftwareProduct = VSPEditorFactory.build();
36 currentScreen: CurrentScreenFactory.build(),
37 softwareProduct: SoftwareProductFactory.build({
38 softwareProductEditor: {
39 data: currentSoftwareProduct
41 softwareProductComponents: {
46 qgenericFieldInfo: {},
56 var results = computeEditorMapStateToProps(obj);
57 expect(results.data).toBeTruthy();
58 expect(results.qdata).toBeTruthy();
59 expect(results.qgenericFieldInfo).toBeTruthy();
60 expect(results.dataMap).toBeTruthy();
61 expect(results.genericFieldInfo).toBeTruthy();
62 expect(results.isReadOnlyMode).toBe(false);
63 expect(results.isFormValid).toBeTruthy();
64 expect(results.formReady).toBeTruthy();
67 it('Compute Editor - View Test', () => {
70 data: ComputeFlavorBaseData.build(),
71 qdata: ComputeFlavorQData.build(),
72 dataMap: VSPComponentsComputeDataMapFactory.build(),
73 isReadOnlyMode: false,
74 onDataChanged: () => {},
75 onQDataChanged: () => {},
80 var renderer = TestUtils.createRenderer();
81 renderer.render(<ComputeEditorView {...props}/>);
82 var renderedOutput = renderer.getRenderOutput();
83 expect(renderedOutput).toBeTruthy();