react-version-downgrade
[sdc.git] / openecomp-ui / test / softwareProduct / processes / SoftwareProductEditor.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/processes/SoftwareProductProcessesEditor.js';
20 import SoftwareProductProcessesEditorView from 'sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesEditorView.jsx';
21 import {VSPEditorFactory} from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js';
22
23 describe('Software Product  Processes Editor Module Tests', function () {
24
25         it('should mapper exist', () => {
26                 expect(mapStateToProps).toBeTruthy();
27         });
28
29         it('should return empty data', () => {
30
31                 const currentSoftwareProduct = VSPEditorFactory.build();
32
33                 var state = {
34                         softwareProduct: {
35                                 softwareProductEditor: {
36                                         data: currentSoftwareProduct
37                                 },
38                                 softwareProductProcesses:
39                                 {
40                                         processesList: [],
41                                         processesEditor: {data: {}}
42                                 }
43                         }
44                 };
45
46                 var results = mapStateToProps(state);
47                 expect(results.data).toEqual({});
48                 expect(results.previousData).toEqual(undefined);
49         });
50
51         it('jsx view test', () => {
52                 var view = TestUtils.renderIntoDocument(<SoftwareProductProcessesEditorView
53                         isReadOnlyMode={true}
54                         data={{}}
55                         previousData={{}}
56                         onDataChanged={() => {}}
57                         onSubmit={() => {}}
58                         onClose={() => {}}/>);
59                 expect(view).toBeTruthy();
60         });
61
62 });