Add collaboration feature
[sdc.git] / openecomp-ui / test / softwareProduct / deployment / SoftwareProductDeploymentEditor.test.js
1 /*!
2  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 import React from 'react';
17 import TestUtils from 'react-addons-test-utils';
18 import { mapStateToProps }  from 'sdc-app/onboarding/softwareProduct/deployment/editor/SoftwareProductDeploymentEditor.js';
19 import SoftwareProductDeploymentEditorView from 'sdc-app/onboarding/softwareProduct/deployment/editor/SoftwareProductDeploymentEditorView.jsx';
20 import { VSPComponentsFactory } from 'test-utils/factories/softwareProduct/SoftwareProductComponentsFactories.js';
21 import { VSPEditorFactoryWithLicensingData } from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js';
22 import { FeatureGroupStoreFactory } from 'test-utils/factories/licenseModel/FeatureGroupFactories.js';
23 import CurrentScreenFactory from 'test-utils/factories/common/CurrentScreenFactory.js';
24
25 describe('Software Product Deployment Editor Module Tests', function () {
26
27         it('should mapper exist', () => {
28                 expect(mapStateToProps).toBeTruthy();
29         });
30
31         it('should return empty data', () => {
32
33                 const currentSoftwareProduct = VSPEditorFactoryWithLicensingData.build();
34                 const componentsList = VSPComponentsFactory.buildList(1);
35                 const featureGroupsList = FeatureGroupStoreFactory.buildList(2);
36                 const currentScreen = CurrentScreenFactory.build();
37
38                 var state = {
39                         currentScreen,
40                         softwareProduct: {
41                                 softwareProductEditor: {
42                                         data: currentSoftwareProduct
43                                 },
44                                 softwareProductDeployment:
45                                 {
46                                         deploymentFlavors: [],
47                                         deploymentFlavorEditor: {data: {}}
48                                 },
49                                 softwareProductComponents: {
50                                         componentsList,
51                                         computeFlavor: {
52                                                 computesList: []
53                                         }
54                                 }
55                         },
56                         licenseModel: {
57                                 featureGroup: {
58                                         featureGroupsList
59                                 }
60                         }
61                 };
62
63                 var results = mapStateToProps(state);
64                 expect(results.data).toEqual({});
65         });
66
67         it('jsx view test', () => {
68                 const componentsList = VSPComponentsFactory.buildList(1);
69                 var renderer = TestUtils.createRenderer();
70                 renderer.render(
71                         <SoftwareProductDeploymentEditorView
72                                 isReadOnlyMode={true}
73                                 selectedFeatureGroupsList={[]}
74                                 componentsList={componentsList}
75                                 data={{}}
76                                 onDataChanged={() => {}}
77                                 onSubmit={() => {}}
78                                 onClose={() => {}}/>
79                         );
80                 var renderedOutput = renderer.getRenderOutput();
81                 expect(renderedOutput).toBeTruthy();
82         });
83
84 });