2 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
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
13 * or implied. See the License for the specific language governing
14 * permissions and limitations under the License.
17 import React from 'react';
18 import TestUtils from 'react-addons-test-utils';
20 import {mapStateToProps} from 'sdc-app/onboarding/softwareProduct/components/processes/SoftwareProductComponentProcessesList.js';
21 import SoftwareProductComponentsProcessesView from 'sdc-app/onboarding/softwareProduct/components/processes/SoftwareProductComponentsProcessesListView.jsx';
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';
27 describe('SoftwareProductComponetsProcesses Mapper and View Classes', () => {
28 it('mapStateToProps mapper exists', () => {
29 expect(mapStateToProps).toBeTruthy();
32 it('mapStateToProps data test', () => {
33 const currentSoftwareProduct = VSPEditorFactory.build();
35 const processesList = VSPProcessStoreFactory.buildList(2);
39 softwareProductEditor: {
40 data: currentSoftwareProduct
42 softwareProductComponents: {
52 var results = mapStateToProps(state);
53 expect(results.processesList.length).toBe(2);
56 it('view simple test', () => {
57 const currentSoftwareProduct = VSPEditorFactory.build();
58 const currentSoftwareProductComponent = VSPComponentsFactory.build();
59 const processesList = VSPProcessStoreFactory.buildList(2);
61 var renderer = TestUtils.createRenderer();
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}/>
74 var renderedOutput = renderer.getRenderOutput();
75 expect(renderedOutput).toBeTruthy();