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/components/loadBalancing/SoftwareProductComponentLoadBalancing.js';
25 import SoftwareProductComponentLoadBalancingView from 'sdc-app/onboarding/softwareProduct/components/loadBalancing/SoftwareProductComponentLoadBalancingRefView.jsx';
26 import {statusEnum as versionStatusEnum} from 'nfvo-components/panel/versionController/VersionControllerConstants.js';
29 describe('SoftwareProductComponentLoadBalancing Mapper and View Classes', () => {
30 it('mapStateToProps mapper exists', () => {
31 expect(mapStateToProps).toExist();
34 it('mapStateToProps data test', () => {
36 const currentSoftwareProduct = {
40 vendorId: '97B3E2525E0640ACACF87CE6B3753E80',
41 category: 'resourceNewCategory.application l4+',
42 subCategory: 'resourceNewCategory.application l4+.database',
43 id: 'D4774719D085414E9D5642D1ACD59D20',
45 viewableVersions: ['0.1', '0.2'],
46 status: versionStatusEnum.CHECK_OUT_STATUS,
52 softwareProductEditor: {
53 data: currentSoftwareProduct
55 softwareProductComponents: {
64 var results = mapStateToProps(obj);
65 expect(results.qdata).toExist();
66 expect(results.qschema).toExist();
70 it('VSP Components LoadBalancing view test', () => {
72 const currentSoftwareProduct = {
76 vendorId: '97B3E2525E0640ACACF87CE6B3753E80',
77 category: 'resourceNewCategory.application l4+',
78 subCategory: 'resourceNewCategory.application l4+.database',
79 id: 'D4774719D085414E9D5642D1ACD59D20',
81 viewableVersions: ['0.1', '0.2'],
82 status: versionStatusEnum.CHECK_OUT_STATUS,
86 const softwareProductComponents = {
90 $schema: 'http://json-schema.org/draft-04/schema#',
102 const versionControllerData = {
104 viewableVersions: [],
109 var renderer = TestUtils.createRenderer();
111 <SoftwareProductComponentLoadBalancingView
112 softwareProductComponents={softwareProductComponents}
113 versionControllerData={versionControllerData}
114 currentSoftwareProduct={currentSoftwareProduct}
115 softwareProductId='123'
116 componentId='321'/>);
117 var renderedOutput = renderer.getRenderOutput();
118 expect(renderedOutput).toExist();