2 * Copyright © 2016-2017 European Support Limited
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 or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 import React from 'react';
18 import TestUtils from 'react-addons-test-utils';
19 import {mapStateToProps} from 'sdc-app/onboarding/softwareProduct/components/general/SoftwareProductComponentsGeneral.js';
20 import SoftwareProductComponentsGeneralView from 'sdc-app/onboarding/softwareProduct/components/general/SoftwareProductComponentsGeneralView.jsx';
21 //import {statusEnum as versionStatusEnum} from 'nfvo-components/panel/versionController/VersionControllerConstants.js';
23 import {VSPEditorFactory} from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js';
24 import {VSPComponentsVersionControllerFactory} from 'test-utils/factories/softwareProduct/SoftwareProductComponentsNetworkFactories.js';
25 import {SoftwareProductFactory} from 'test-utils/factories/softwareProduct/SoftwareProductFactory.js';
26 import VSPQSchemaFactory from 'test-utils/factories/softwareProduct/SoftwareProductQSchemaFactory.js';
29 describe('SoftwareProductComponentsGeneral Mapper and View Classes', () => {
30 it('mapStateToProps mapper exists', () => {
31 expect(mapStateToProps).toBeTruthy();
34 it('mapStateToProps data test', () => {
36 const currentSoftwareProduct = VSPEditorFactory.build();
39 softwareProduct: SoftwareProductFactory.build({
40 softwareProductEditor: {
41 data: currentSoftwareProduct
43 softwareProductComponents: {
52 var results = mapStateToProps(obj);
53 expect(results.componentData).toBeTruthy();
54 expect(results.qdata).toBeTruthy();
58 it('VSP Components general view test', () => {
60 const currentSoftwareProduct = VSPEditorFactory.build();
62 const softwareProductComponents = {
66 qschema: VSPQSchemaFactory.build()
70 const versionControllerData = VSPComponentsVersionControllerFactory.build();
72 const componentData = {
76 var renderer = TestUtils.createRenderer();
78 <SoftwareProductComponentsGeneralView
79 componentData={componentData}
80 softwareProductComponents={softwareProductComponents}
81 versionControllerData={versionControllerData}
82 currentSoftwareProduct={currentSoftwareProduct}/>);
83 var renderedOutput = renderer.getRenderOutput();
84 expect(renderedOutput).toBeTruthy();