2 * Copyright © 2016-2017 European Support Limited
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 import React from 'react';
18 import ShallowRenderer from 'react-test-renderer/shallow';
19 import {mapStateToProps} from 'sdc-app/onboarding/softwareProduct/components/processes/SoftwareProductComponentProcessesList.js';
20 import SoftwareProductComponentsProcessesView from 'sdc-app/onboarding/softwareProduct/components/processes/SoftwareProductComponentsProcessesListView.jsx';
22 import {VSPProcessStoreFactory} from 'test-utils/factories/softwareProduct/SoftwareProductProcessFactories.js';
23 import {VSPEditorFactory} from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js';
24 import {VSPComponentsFactory} from 'test-utils/factories/softwareProduct/SoftwareProductComponentsFactories.js';
26 describe('SoftwareProductComponetsProcesses Mapper and View Classes', () => {
27 it('mapStateToProps mapper exists', () => {
28 expect(mapStateToProps).toBeTruthy();
31 it('mapStateToProps data test', () => {
32 const currentSoftwareProduct = VSPEditorFactory.build();
34 const processesList = VSPProcessStoreFactory.buildList(2);
38 softwareProductEditor: {
39 data: currentSoftwareProduct
41 softwareProductComponents: {
51 var results = mapStateToProps(state);
52 expect(results.processesList.length).toBe(2);
55 it('view simple test', () => {
56 const currentSoftwareProduct = VSPEditorFactory.build();
57 const currentSoftwareProductComponent = VSPComponentsFactory.build();
58 const processesList = VSPProcessStoreFactory.buildList(2);
60 const renderer = new ShallowRenderer();
62 <SoftwareProductComponentsProcessesView
63 processesList={processesList}
64 currentSoftwareProduct={currentSoftwareProduct}
65 softwareProductId={currentSoftwareProduct.id}
66 componentId={currentSoftwareProductComponent.id}
67 onAddProcess={() => {}}
68 onEditProcess={() => {}}
69 onDeleteProcess={() => {}}
70 isDisplayEditor={false}
71 isReadOnlyMode={false}/>
73 var renderedOutput = renderer.getRenderOutput();
74 expect(renderedOutput).toBeTruthy();