blob: dff52edf5d2ff86d1e661917156fad74156e2e63 [file] [log] [blame]
svishnev1eb66b72018-01-11 14:39:45 +02001/*
2 * Copyright © 2016-2017 European Support Limited
Avi Zivb8e2faf2017-07-18 19:45:38 +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 *
Avi Zivb8e2faf2017-07-18 19:45:38 +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.
Avi Zivb8e2faf2017-07-18 19:45:38 +030015 */
16import React from 'react';
svishnevaa2eece2018-01-18 17:52:06 +020017import TestUtils from 'react-addons-test-utils';
Avi Zivb8e2faf2017-07-18 19:45:38 +030018import {mapStateToProps} from 'sdc-app/onboarding/softwareProduct/deployment/SoftwareProductDeployment.js';
19import SoftwareProductDeploymentView from 'sdc-app/onboarding/softwareProduct/deployment/SoftwareProductDeploymentView.jsx';
20
21import {VSPDeploymentStoreFactory} from 'test-utils/factories/softwareProduct/SoftwareProductDeploymentFactories.js';
22import {VSPComponentsFactory} from 'test-utils/factories/softwareProduct/SoftwareProductComponentsFactories.js';
23import {VSPEditorFactory} from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js';
24
25describe('SoftwareProductDeployment Mapper and View Classes', () => {
26 it ('mapStateToProps mapper exists', () => {
27 expect(mapStateToProps).toBeTruthy();
28 });
29
30 it ('mapStateToProps data test', () => {
31
32 const currentSoftwareProduct = VSPEditorFactory.build();
33
34 const deploymentFlavors = VSPDeploymentStoreFactory.buildList(2);
35
36 const componentsList = VSPComponentsFactory.buildList(1);
37
38 var state = {
39 softwareProduct: {
40 softwareProductEditor: {
41 data: currentSoftwareProduct
42 },
43 softwareProductDeployment:
44 {
45 deploymentFlavors,
46 deploymentFlavorsEditor: {data: {}}
47 },
48 softwareProductComponents: {
49 componentsList
50 }
51 }
52 };
53 var results = mapStateToProps(state);
54 expect(results.deploymentFlavors).toBeTruthy();
55 });
56
57 it ('view simple test', () => {
58
59 const currentSoftwareProduct = VSPEditorFactory.build();
60
61 const deploymentFlavors = VSPDeploymentStoreFactory.buildList(2);
62
svishnevaa2eece2018-01-18 17:52:06 +020063 var renderer = TestUtils.createRenderer();
Avi Zivb8e2faf2017-07-18 19:45:38 +030064 renderer.render(
65 <SoftwareProductDeploymentView
66 deploymentFlavors={deploymentFlavors}
67 currentSoftwareProduct={currentSoftwareProduct}
68 onAddDeployment={() => {}}
69 onEditDeployment={() => {}}
70 onDeleteDeployment={() => {}}
71 isReadOnlyMode={false} />
72 );
73 var renderedOutput = renderer.getRenderOutput();
74 expect(renderedOutput).toBeTruthy();
75
76 });
77});