blob: 345c46999bc8647515341823bec59a3a38cfabde [file] [log] [blame]
svishnev1eb66b72018-01-11 14:39:45 +02001/*
2 * Copyright © 2016-2017 European Support Limited
AviZi280f8012017-06-09 02:39:56 +03003 *
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
svishnev1eb66b72018-01-11 14:39:45 +02007 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
AviZi280f8012017-06-09 02:39:56 +030010 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
svishnev1eb66b72018-01-11 14:39:45 +020012 * 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.
AviZi280f8012017-06-09 02:39:56 +030015 */
16
17import React from 'react';
svishnevaa2eece2018-01-18 17:52:06 +020018import TestUtils from 'react-addons-test-utils';
AviZi280f8012017-06-09 02:39:56 +030019import {mapStateToProps} from 'sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcesses.js';
20import SoftwareProductProcessesView from 'sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesView.jsx';
21
22import {VSPProcessStoreFactory} from 'test-utils/factories/softwareProduct/SoftwareProductProcessFactories.js';
23import {VSPEditorFactory} from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js';
24import {VSPComponentsVersionControllerFactory} from 'test-utils/factories/softwareProduct/SoftwareProductComponentsNetworkFactories.js';
25
26describe('SoftwareProductProcesses Mapper and View Classes', () => {
svishnev1eb66b72018-01-11 14:39:45 +020027 it ('mapStateToProps mapper exists', () => {
AviZi280f8012017-06-09 02:39:56 +030028 expect(mapStateToProps).toBeTruthy();
29 });
30
svishnev1eb66b72018-01-11 14:39:45 +020031 it ('mapStateToProps data test', () => {
AviZi280f8012017-06-09 02:39:56 +030032 const currentSoftwareProduct = VSPEditorFactory.build();
33
34 const processesList = VSPProcessStoreFactory.buildList(2);
35
36 var obj = {
37 softwareProduct: {
38 softwareProductEditor: {
39 data: currentSoftwareProduct
40 },
41 softwareProductProcesses:
42 {
43 processesList,
44 processesEditor: {data: {}}
45 }
46 }
47 };
48 var results = mapStateToProps(obj);
49 expect(results.processesList).toBeTruthy();
50 });
51
svishnev1eb66b72018-01-11 14:39:45 +020052 it ('view simple test', () => {
53 const currentSoftwareProduct = VSPEditorFactory.build();
AviZi280f8012017-06-09 02:39:56 +030054 const processesList = VSPProcessStoreFactory.buildList(2);
55
56 const versionControllerData = VSPComponentsVersionControllerFactory.build();
svishnev1eb66b72018-01-11 14:39:45 +020057
58
svishnevaa2eece2018-01-18 17:52:06 +020059 var renderer = TestUtils.createRenderer();
AviZi280f8012017-06-09 02:39:56 +030060 renderer.render(
61 <SoftwareProductProcessesView
62 processesList={processesList}
63 versionControllerData={versionControllerData}
svishnev1eb66b72018-01-11 14:39:45 +020064 currentSoftwareProduct={currentSoftwareProduct}
AviZi280f8012017-06-09 02:39:56 +030065 onAddProcess={() => {}}
66 onEditProcess={() => {}}
67 onDeleteProcess={() => {}}
68 isDisplayEditor={false}
69 isReadOnlyMode={false} />
70 );
71 var renderedOutput = renderer.getRenderOutput();
72 expect(renderedOutput).toBeTruthy();
73
74 });
75});