2 * Copyright © 2016-2018 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-dom/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() {
27 it('should mapper exist', () => {
28 expect(mapStateToProps).toBeTruthy();
31 it('should return empty data', () => {
32 let licenseModel = LicenseModelOverviewFactory.build({
34 featureGroupEditor: {},
39 ...VersionControllerUtilsFactory.build()
43 var results = mapStateToProps({ licenseModel });
44 expect(results.vendorName).toEqual(undefined);
45 expect(results.featureGroupsList).toEqual([]);
48 it('should return true for show and edit mode and vendorName should be not empty', () => {
49 let licenseModel = LicenseModelOverviewFactory.build({
52 data: FeatureGroupStoreFactory.build()
57 var results = mapStateToProps({ licenseModel });
58 expect(results.vendorName).toEqual(
59 licenseModel.licenseModelEditor.data.vendorName
63 it('jsx view test', () => {
64 var view = TestUtils.renderIntoDocument(
65 <FeatureGroupsListEditorView
68 isReadOnlyMode={false}
69 onAddFeatureGroupClick={() => {}}
70 featureGroupsList={[]}
73 expect(view).toBeTruthy();
76 it('jsx view list test', () => {
77 var view = TestUtils.renderIntoDocument(
78 <FeatureGroupsListEditorView
81 isReadOnlyMode={false}
82 onAddFeatureGroupClick={() => {}}
83 featureGroupsList={buildListFromFactory(
84 FeatureGroupStoreFactory
88 expect(view).toBeTruthy();