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/licenseModel/featureGroups/FeatureGroupListEditor.js';
20 import FeatureGroupsListEditorView from 'sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx';
21 import { FeatureGroupStoreFactory } from 'test-utils/factories/licenseModel/FeatureGroupFactories.js';
22 import {LicenseModelOverviewFactory} from 'test-utils/factories/licenseModel/LicenseModelFactories.js';
23 import { buildListFromFactory } from 'test-utils/Util.js';
24 import VersionControllerUtilsFactory from 'test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js';
26 describe('License Model Feature Group List Module Tests', function () {
28 it('should mapper exist', () => {
29 expect(mapStateToProps).toBeTruthy();
33 it('should return empty data', () => {
36 let licenseModel = LicenseModelOverviewFactory.build({
38 featureGroupEditor: {},
43 ...VersionControllerUtilsFactory.build()
47 var results = mapStateToProps({licenseModel});
48 expect(results.vendorName).toEqual(undefined);
49 expect(results.featureGroupsModal.show).toEqual(false);
50 expect(results.featureGroupsModal.editMode).toEqual(false);
51 expect(results.featureGroupsList).toEqual([]);
54 it('should return true for show and edit mode and vendorName should be not empty', () => {
56 let licenseModel = LicenseModelOverviewFactory.build({
59 data: FeatureGroupStoreFactory.build()
64 var results = mapStateToProps({licenseModel});
65 expect(results.featureGroupsModal.show).toEqual(true);
66 expect(results.featureGroupsModal.editMode).toEqual(true);
67 expect(results.vendorName).toEqual(licenseModel.licenseModelEditor.data.vendorName);
70 it('jsx view test', () => {
71 var view = TestUtils.renderIntoDocument(<FeatureGroupsListEditorView vendorName=''
73 featureGroupsModal={{show: false, editMode: false}}
74 isReadOnlyMode={false}
75 onAddFeatureGroupClick={()=>{}}
76 featureGroupsList={[]} />);
77 expect(view).toBeTruthy();
80 it('jsx view list test', () => {
81 var view = TestUtils.renderIntoDocument(<FeatureGroupsListEditorView vendorName=''
83 featureGroupsModal={{show: false, editMode: true}}
84 isReadOnlyMode={false}
85 onAddFeatureGroupClick={()=>{}}
86 featureGroupsList={buildListFromFactory(FeatureGroupStoreFactory)} />);
87 expect(view).toBeTruthy();