2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 import expect from 'expect';
22 import React from 'react';
23 import TestUtils from 'react-addons-test-utils';
24 import {mapStateToProps} from 'sdc-app/onboarding/softwareProduct/networks/SoftwareProductNetworks.js';
25 import SoftwareProductNetworksView from 'sdc-app/onboarding/softwareProduct/networks/SoftwareProductNetworksView.jsx';
26 import {statusEnum as versionStatusEnum} from 'nfvo-components/panel/versionController/VersionControllerConstants.js';
28 describe('SoftwareProductNetworks Mapper and View Classes', () => {
29 it ('mapStateToProps mapper exists', () => {
30 expect(mapStateToProps).toExist();
33 it ('mapStateToProps data test', () => {
35 const currentSoftwareProduct = {
39 vendorId: '97B3E2525E0640ACACF87CE6B3753E80',
40 category: 'resourceNewCategory.application l4+',
41 subCategory: 'resourceNewCategory.application l4+.database',
42 id: 'D4774719D085414E9D5642D1ACD59D20',
44 viewableVersions: ['0.1', '0.2'],
45 status: versionStatusEnum.CHECK_OUT_STATUS,
49 const networksList = [
53 'id':'7F60CD390458421DA588AF4AD217B93F'
58 'id':'AD217B93F7F60CD390458421DA588AF4'
64 softwareProductEditor: {
65 data:currentSoftwareProduct
67 softwareProductNetworks:
73 var results = mapStateToProps(obj);
74 expect(results.networksList,).toExist();
77 it ('view simple test', () => {
79 const currentSoftwareProduct = {
83 vendorId: '97B3E2525E0640ACACF87CE6B3753E80',
84 category: 'resourceNewCategory.application l4+',
85 subCategory: 'resourceNewCategory.application l4+.database',
86 id: 'D4774719D085414E9D5642D1ACD59D20',
88 viewableVersions: ['0.1', '0.2'],
89 status: versionStatusEnum.CHECK_OUT_STATUS,
93 const networksList = [
97 'id':'7F60CD390458421DA588AF4AD217B93F'
102 'id':'AD217B93F7F60CD390458421DA588AF4'
106 const versionControllerData = {
108 viewableVersions: [],
113 var renderer = TestUtils.createRenderer();
114 renderer.render(<SoftwareProductNetworksView networksList={networksList} versionControllerData={versionControllerData} currentSoftwareProduct={currentSoftwareProduct}/>);
115 var renderedOutput = renderer.getRenderOutput();
116 expect(renderedOutput).toExist();