blob: 2d7da91cbb85f228906ceac085ce80654cce3f37 [file] [log] [blame]
AviZi280f8012017-06-09 02:39:56 +03001/*!
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
17import React from 'react';
18import TestUtils from 'react-addons-test-utils';
19import {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', () => {
27 it ('mapStateToProps mapper exists', () => {
28 expect(mapStateToProps).toBeTruthy();
29 });
30
31 it ('mapStateToProps data test', () => {
32 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
52 it ('view simple test', () => {
53 const currentSoftwareProduct = VSPEditorFactory.build();
54 const processesList = VSPProcessStoreFactory.buildList(2);
55
56 const versionControllerData = VSPComponentsVersionControllerFactory.build();
57
58
59 var renderer = TestUtils.createRenderer();
60 renderer.render(
61 <SoftwareProductProcessesView
62 processesList={processesList}
63 versionControllerData={versionControllerData}
64 currentSoftwareProduct={currentSoftwareProduct}
65 onAddProcess={() => {}}
66 onEditProcess={() => {}}
67 onDeleteProcess={() => {}}
68 isDisplayEditor={false}
69 isReadOnlyMode={false} />
70 );
71 var renderedOutput = renderer.getRenderOutput();
72 expect(renderedOutput).toBeTruthy();
73
74 });
75});