blob: 9700efe98a5b8674033da0b927f66905af405152 [file] [log] [blame]
Avi Zivb8e2faf2017-07-18 19:45:38 +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 */
16import React from 'react';
17import TestUtils from 'react-addons-test-utils';
18import {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
63 var renderer = TestUtils.createRenderer();
64 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});