react-version-downgrade
[sdc.git] / openecomp-ui / test / softwareProduct / components / loadBalancing / softwareProductComponentLoadbalancing.test.js
1 /*
2  * Copyright © 2016-2017 European Support Limited
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 or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 import React from 'react';
18 import TestUtils from 'react-addons-test-utils';
19 import {mapStateToProps}  from 'sdc-app/onboarding/softwareProduct/components/loadBalancing/SoftwareProductComponentLoadBalancing.js';
20 import SoftwareProductComponentLoadBalancingView from 'sdc-app/onboarding/softwareProduct/components/loadBalancing/SoftwareProductComponentLoadBalancingRefView.jsx';
21
22 import {VSPEditorFactory} from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js';
23 import {SoftwareProductFactory} from 'test-utils/factories/softwareProduct/SoftwareProductFactory.js';
24 import {VSPComponentsVersionControllerFactory} from 'test-utils/factories/softwareProduct/SoftwareProductComponentsNetworkFactories.js';
25 import VSPQSchemaFactory from 'test-utils/factories/softwareProduct/SoftwareProductQSchemaFactory.js';
26
27
28 describe('SoftwareProductComponentLoadBalancing Mapper and View Classes', () => {
29         it('mapStateToProps mapper exists', () => {
30                 expect(mapStateToProps).toBeTruthy();
31         });
32
33         it('mapStateToProps data test', () => {
34
35                 const currentSoftwareProduct = VSPEditorFactory.build();
36
37                 var obj = {
38                         softwareProduct: SoftwareProductFactory.build({
39                                 softwareProductEditor: {
40                                         data: currentSoftwareProduct
41                                 },
42                                 softwareProductComponents: {
43                                         componentEditor: {
44                                                 qdata: {}
45                                         }
46                                 }
47                         })
48                 };
49
50                 var results = mapStateToProps(obj);
51                 expect(results.qdata).toBeTruthy();
52         });
53
54
55         it('VSP Components LoadBalancing view test', () => {
56
57                 const currentSoftwareProduct = VSPEditorFactory.build();
58
59                 const softwareProductComponents = {
60                         componentEditor: {
61                                 qdata: {},
62                                 qschema: VSPQSchemaFactory.build()
63                         }
64                 };
65
66                 const versionControllerData = VSPComponentsVersionControllerFactory.build();
67
68                 var renderer = TestUtils.createRenderer();
69                 renderer.render(
70                         <SoftwareProductComponentLoadBalancingView
71                                 softwareProductComponents={softwareProductComponents}
72                                 versionControllerData={versionControllerData}
73                                 currentSoftwareProduct={currentSoftwareProduct}
74                                 softwareProductId='123'
75                                 componentId='321'/>);
76                 var renderedOutput = renderer.getRenderOutput();
77                 expect(renderedOutput).toBeTruthy();
78
79         });
80
81 });