Add new code new version
[sdc.git] / openecomp-ui / test / softwareProduct / components / network / SoftwareProductComponentsNICEditor.test.js
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 import expect from 'expect';
22 import React from 'react';
23 import TestUtils from 'react-addons-test-utils';
24 import {mapStateToProps}  from 'sdc-app/onboarding/softwareProduct/components/network/SoftwareProductComponentsNICEditor.js';
25 import SoftwareProductComponentsNICEditorView from 'sdc-app/onboarding/softwareProduct/components/network/SoftwareProductComponentsNICEditorView.jsx';
26
27
28
29 describe('Software Product Component Network NIC Editor and View Classes', () => {
30         it('mapStateToProps mapper exists', () => {
31                 expect(mapStateToProps).toExist();
32         });
33
34
35         it('mapStateToProps data test', () => {
36
37                 const currentSoftwareProduct = {
38                         name: 'VSp',
39                         description: 'dfdf',
40                         vendorName: 'V1',
41                         vendorId: '97B3E2525E0640ACACF87CE6B3753E80',
42                         category: 'resourceNewCategory.application l4+',
43                         subCategory: 'resourceNewCategory.application l4+.database',
44                         id: 'D4774719D085414E9D5642D1ACD59D20',
45                         version: '0.10',
46                         viewableVersions: ['0.1', '0.2'],
47                         lockingUser: 'cs0008'
48                 };
49
50
51                 var obj = {
52                         softwareProduct: {
53                                 softwareProductEditor: {
54                                         data: currentSoftwareProduct
55                                 },
56                                 softwareProductComponents: {
57                                         network: {
58                                                 nicEditor: {
59                                                         data: {},
60                                                         qdata: {},
61                                                         qschema: {}
62                                                 }
63                                         }
64                                 }
65                         }
66                 };
67
68                 var results = mapStateToProps(obj);
69                 expect(results.currentSoftwareProduct).toExist();
70                 expect(results.qdata).toExist();
71                 expect(results.qschema).toExist();
72                 expect(results.data).toExist();
73         });
74
75
76         it('Software Product Component Network NIC Editor View Test', () => {
77
78                 const data = {
79                         name: '',
80                         description: '',
81                         networkName: ''
82                 };
83
84                 const qdata = {};
85                 const qschema = {};
86
87                 var renderer = TestUtils.createRenderer();
88                 renderer.render(
89                         <SoftwareProductComponentsNICEditorView
90                                 data={data}
91                                 qdata={qdata}
92                                 qschema={qschema}/>);
93                 var renderedOutput = renderer.getRenderOutput();
94                 expect(renderedOutput).toExist();
95
96         });
97 });