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.
16 import React from 'react';
17 import TestUtils from 'react-addons-test-utils';
18 import {mapStateToProps} from 'sdc-app/onboarding/softwareProduct/deployment/SoftwareProductDeployment.js';
19 import SoftwareProductDeploymentView from 'sdc-app/onboarding/softwareProduct/deployment/SoftwareProductDeploymentView.jsx';
21 import {VSPDeploymentStoreFactory} from 'test-utils/factories/softwareProduct/SoftwareProductDeploymentFactories.js';
22 import {VSPComponentsFactory} from 'test-utils/factories/softwareProduct/SoftwareProductComponentsFactories.js';
23 import {VSPEditorFactory} from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js';
25 describe('SoftwareProductDeployment Mapper and View Classes', () => {
26 it ('mapStateToProps mapper exists', () => {
27 expect(mapStateToProps).toBeTruthy();
30 it ('mapStateToProps data test', () => {
32 const currentSoftwareProduct = VSPEditorFactory.build();
34 const deploymentFlavors = VSPDeploymentStoreFactory.buildList(2);
36 const componentsList = VSPComponentsFactory.buildList(1);
40 softwareProductEditor: {
41 data: currentSoftwareProduct
43 softwareProductDeployment:
46 deploymentFlavorsEditor: {data: {}}
48 softwareProductComponents: {
53 var results = mapStateToProps(state);
54 expect(results.deploymentFlavors).toBeTruthy();
57 it ('view simple test', () => {
59 const currentSoftwareProduct = VSPEditorFactory.build();
61 const deploymentFlavors = VSPDeploymentStoreFactory.buildList(2);
63 var renderer = TestUtils.createRenderer();
65 <SoftwareProductDeploymentView
66 deploymentFlavors={deploymentFlavors}
67 currentSoftwareProduct={currentSoftwareProduct}
68 onAddDeployment={() => {}}
69 onEditDeployment={() => {}}
70 onDeleteDeployment={() => {}}
71 isReadOnlyMode={false} />
73 var renderedOutput = renderer.getRenderOutput();
74 expect(renderedOutput).toBeTruthy();