Add collaboration feature
[sdc.git] / openecomp-ui / test / softwareProduct / components / processes / SoftwareProductComponentsProcessesView.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
17 import React from 'react';
18 import TestUtils from 'react-addons-test-utils';
19
20 import {mapStateToProps} from 'sdc-app/onboarding/softwareProduct/components/processes/SoftwareProductComponentProcessesList.js';
21 import SoftwareProductComponentsProcessesView from 'sdc-app/onboarding/softwareProduct/components/processes/SoftwareProductComponentsProcessesListView.jsx';
22
23 import {VSPProcessStoreFactory} from 'test-utils/factories/softwareProduct/SoftwareProductProcessFactories.js';
24 import {VSPEditorFactory} from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js';
25 import {VSPComponentsFactory} from 'test-utils/factories/softwareProduct/SoftwareProductComponentsFactories.js';
26
27 describe('SoftwareProductComponetsProcesses Mapper and View Classes', () => {
28         it('mapStateToProps mapper exists', () => {             
29                 expect(mapStateToProps).toBeTruthy();
30         });
31
32         it('mapStateToProps data test', () => {         
33                 const currentSoftwareProduct = VSPEditorFactory.build();
34
35                 const processesList = VSPProcessStoreFactory.buildList(2);
36
37                 var state = {
38                         softwareProduct: {
39                                 softwareProductEditor: {
40                                         data: currentSoftwareProduct
41                                 },
42                                 softwareProductComponents: {
43                                         componentProcesses: {
44                                                 processesList,
45                                                 processesEditor: {
46                                                         data: {}
47                                                 }
48                                         }
49                                 }
50                         }
51                 };
52                 var results = mapStateToProps(state);
53                 expect(results.processesList.length).toBe(2);
54         });
55
56         it('view simple test', () => {          
57                 const currentSoftwareProduct = VSPEditorFactory.build();
58                 const currentSoftwareProductComponent = VSPComponentsFactory.build();
59                 const processesList = VSPProcessStoreFactory.buildList(2);
60
61                 var renderer = TestUtils.createRenderer();
62                 renderer.render(
63                         <SoftwareProductComponentsProcessesView
64                                 processesList={processesList}
65                                 currentSoftwareProduct={currentSoftwareProduct}
66                                 softwareProductId={currentSoftwareProduct.id}
67                                 componentId={currentSoftwareProductComponent.id}
68                                 onAddProcess={() => {}}
69                                 onEditProcess={() => {}}
70                                 onDeleteProcess={() => {}}
71                                 isDisplayEditor={false}
72                                 isReadOnlyMode={false}/>
73                         );
74                 var renderedOutput = renderer.getRenderOutput();
75                 expect(renderedOutput).toBeTruthy();
76         });
77 });