2 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
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
13 * or implied. See the License for the specific language governing
14 * permissions and 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';
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 softwareProduct: SoftwareProductFactory.build({
37 softwareProductEditor: {
38 data: currentSoftwareProduct
40 softwareProductComponents: {
45 qgenericFieldInfo: {},
55 var results = computeEditorMapStateToProps(obj);
56 expect(results.data).toBeTruthy();
57 expect(results.qdata).toBeTruthy();
58 expect(results.qgenericFieldInfo).toBeTruthy();
59 expect(results.dataMap).toBeTruthy();
60 expect(results.genericFieldInfo).toBeTruthy();
61 expect(results.isReadOnlyMode).toBeTruthy();
62 expect(results.isFormValid).toBeTruthy();
63 expect(results.formReady).toBeTruthy();
66 it('Compute Editor - View Test', () => {
69 data: ComputeFlavorBaseData.build(),
70 qdata: ComputeFlavorQData.build(),
71 dataMap: VSPComponentsComputeDataMapFactory.build(),
72 isReadOnlyMode: false,
73 onDataChanged: () => {},
74 onQDataChanged: () => {},
79 var renderer = TestUtils.createRenderer();
80 renderer.render(<ComputeEditorView {...props}/>);
81 var renderedOutput = renderer.getRenderOutput();
82 expect(renderedOutput).toBeTruthy();