[SDC] Onboarding 1710 rebase.
[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
24 describe('Software Product Deployment Editor Module Tests', function () {
25
26         it('should mapper exist', () => {
27                 expect(mapStateToProps).toBeTruthy();
28         });
29
30         it('should return empty data', () => {
31
32                 const currentSoftwareProduct = VSPEditorFactoryWithLicensingData.build();
33                 const componentsList = VSPComponentsFactory.buildList(1);
34                 const featureGroupsList = FeatureGroupStoreFactory.buildList(2);
35
36                 var state = {
37                         softwareProduct: {
38                                 softwareProductEditor: {
39                                         data: currentSoftwareProduct
40                                 },
41                                 softwareProductDeployment:
42                                 {
43                                         deploymentFlavors: [],
44                                         deploymentFlavorEditor: {data: {}}
45                                 },
46                                 softwareProductComponents: {
47                                         componentsList,
48                                         computeFlavor: {
49                                                 computesList: []
50                                         }
51                                 }
52                         },
53                         licenseModel: {
54                                 featureGroup: {
55                                         featureGroupsList
56                                 }
57                         }
58                 };
59
60                 var results = mapStateToProps(state);
61                 expect(results.data).toEqual({});
62         });
63
64         it('jsx view test', () => {
65                 const componentsList = VSPComponentsFactory.buildList(1);
66                 var renderer = TestUtils.createRenderer();
67                 renderer.render(
68                         <SoftwareProductDeploymentEditorView
69                                 isReadOnlyMode={true}
70                                 selectedFeatureGroupsList={[]}
71                                 componentsList={componentsList}
72                                 data={{}}
73                                 onDataChanged={() => {}}
74                                 onSubmit={() => {}}
75                                 onClose={() => {}}/>
76                         );
77                 var renderedOutput = renderer.getRenderOutput();
78                 expect(renderedOutput).toBeTruthy();
79         });
80
81 });