aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-ui/test/licenseModel/overview
diff options
context:
space:
mode:
authorAviZi <avi.ziv@amdocs.com>2017-06-09 02:39:56 +0300
committerAviZi <avi.ziv@amdocs.com>2017-06-09 02:39:56 +0300
commit280f8015d06af1f41a3ef12e8300801c7a5e0d54 (patch)
tree9c1d3978c04cd28068f02073038c936bb49ca9e0 /openecomp-ui/test/licenseModel/overview
parentfd3821dad11780d33c5373d74c957c442489945e (diff)
[SDC-29] Amdocs OnBoard 1707 initial commit.
Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370 Signed-off-by: AviZi <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-ui/test/licenseModel/overview')
-rw-r--r--openecomp-ui/test/licenseModel/overview/listItems/EntitlementPool.test.js31
-rw-r--r--openecomp-ui/test/licenseModel/overview/listItems/FeatureGroup.test.js58
-rw-r--r--openecomp-ui/test/licenseModel/overview/listItems/LicenseAgreement.test.js54
-rw-r--r--openecomp-ui/test/licenseModel/overview/listItems/LicenseKeyGroup.test.js31
-rw-r--r--openecomp-ui/test/licenseModel/overview/summary/SummaryCountList.test.js87
-rw-r--r--openecomp-ui/test/licenseModel/overview/summary/VendorDataView.test.js48
-rw-r--r--openecomp-ui/test/licenseModel/overview/test.js355
-rw-r--r--openecomp-ui/test/licenseModel/overview/views.test.js159
8 files changed, 823 insertions, 0 deletions
diff --git a/openecomp-ui/test/licenseModel/overview/listItems/EntitlementPool.test.js b/openecomp-ui/test/licenseModel/overview/listItems/EntitlementPool.test.js
new file mode 100644
index 0000000000..6c4a05eb16
--- /dev/null
+++ b/openecomp-ui/test/licenseModel/overview/listItems/EntitlementPool.test.js
@@ -0,0 +1,31 @@
+/*!
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+import React from 'react';
+import TestUtils from 'react-addons-test-utils';
+import EntitlementPool from 'src/sdc-app/onboarding/licenseModel/overview/listItems/EntitlementPool.jsx';
+import {EntitlementPoolListItemFactory} from 'test-utils/factories/licenseModel/EntitlementPoolFactories.js';
+
+describe('Entitlement Pool List Item Module Tests', function () {
+ it('Entitlement Pool List Item should exist', () => {
+ expect(EntitlementPool).toBeTruthy();
+ });
+ it('renders Entitlement Pool List Item', () => {
+ const epData = EntitlementPoolListItemFactory.build();
+ const itemView = TestUtils.renderIntoDocument( <EntitlementPool epData={epData} /> );
+ expect(itemView).toBeTruthy();
+ });
+});
diff --git a/openecomp-ui/test/licenseModel/overview/listItems/FeatureGroup.test.js b/openecomp-ui/test/licenseModel/overview/listItems/FeatureGroup.test.js
new file mode 100644
index 0000000000..10b7801889
--- /dev/null
+++ b/openecomp-ui/test/licenseModel/overview/listItems/FeatureGroup.test.js
@@ -0,0 +1,58 @@
+/*!
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+import React from 'react';
+import TestUtils from 'react-addons-test-utils';
+import FeatureGroup from 'src/sdc-app/onboarding/licenseModel/overview/listItems/FeatureGroup.jsx';
+import {scryRenderedDOMComponentsWithTestId} from 'test-utils/Util.js';
+import {FeatureGroupListItemFactory} from 'test-utils/factories/licenseModel/FeatureGroupFactories.js';
+import {EntitlementPoolListItemFactory} from 'test-utils/factories/licenseModel/EntitlementPoolFactories.js';
+import {LicenseKeyGroupListItemFactory} from 'test-utils/factories/licenseModel/LicenseKeyGroupFactories.js';
+
+describe('Feature Group List Item Module Tests', function () {
+ it('Feature Group List Item should exist', () => {
+ expect(FeatureGroup).toBeTruthy();
+ });
+
+ it('renders Feature Group List Item Collapsed', () => {
+ const fgData = FeatureGroupListItemFactory.build();
+ const itemView = TestUtils.renderIntoDocument( <FeatureGroup fgData={fgData} /> );
+ expect(itemView).toBeTruthy();
+ const elem = TestUtils.scryRenderedDOMComponentsWithClass(itemView,'down');
+ expect(elem).toBeTruthy();
+ });
+
+ it('renders Feature Group List Item Expanded', () => {
+ const fgData = FeatureGroupListItemFactory.build({isCollpased: false});
+ const itemView = TestUtils.renderIntoDocument( <FeatureGroup fgData={fgData} /> );
+ expect(itemView).toBeTruthy();
+ const elem = TestUtils.scryRenderedDOMComponentsWithClass(itemView,'right');
+ expect(elem).toBeTruthy();
+ });
+
+ it('renders Feature Group List Item with Children Count', () => {
+ const children = [EntitlementPoolListItemFactory.build(), LicenseKeyGroupListItemFactory.build()];
+ const fgData = FeatureGroupListItemFactory.build({children: children, isCollpased: false});
+ const itemView = TestUtils.renderIntoDocument( <FeatureGroup fgData={fgData} /> );
+ expect(itemView).toBeTruthy();
+ let elem = scryRenderedDOMComponentsWithTestId(itemView,'vlm-list-ep-count-value');
+ expect(elem).toBeTruthy();
+ expect(elem[0].innerHTML).toBe('1');
+ elem = scryRenderedDOMComponentsWithTestId(itemView,'vlm-list-lkg-count-value');
+ expect(elem).toBeTruthy();
+ expect(elem[0].innerHTML).toBe('1');
+ });
+});
diff --git a/openecomp-ui/test/licenseModel/overview/listItems/LicenseAgreement.test.js b/openecomp-ui/test/licenseModel/overview/listItems/LicenseAgreement.test.js
new file mode 100644
index 0000000000..608a76965f
--- /dev/null
+++ b/openecomp-ui/test/licenseModel/overview/listItems/LicenseAgreement.test.js
@@ -0,0 +1,54 @@
+/*!
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+import React from 'react';
+import TestUtils from 'react-addons-test-utils';
+import LicenseAgreement from 'src/sdc-app/onboarding/licenseModel/overview/listItems/LicenseAgreement.jsx';
+import {scryRenderedDOMComponentsWithTestId} from 'test-utils/Util.js';
+import {LicenseAgreementListItemFactory} from 'test-utils/factories/licenseModel/LicenseAgreementFactories.js';
+import {FeatureGroupListItemFactory} from 'test-utils/factories/licenseModel/FeatureGroupFactories.js';
+
+describe('License Agreement List Item Module Tests', function () {
+ it('License Agreement List Item should exist', () => {
+ expect(LicenseAgreement).toBeTruthy();
+ });
+
+ it('renders License Agreement List Item Collapsed', () => {
+ const laData = LicenseAgreementListItemFactory.build();
+ const itemView = TestUtils.renderIntoDocument( <LicenseAgreement laData={laData} /> );
+ expect(itemView).toBeTruthy();
+ const elem = TestUtils.scryRenderedDOMComponentsWithClass(itemView,'down');
+ expect(elem).toBeTruthy();
+ });
+
+ it('renders License Agreement List Item Expanded', () => {
+ const laData = LicenseAgreementListItemFactory.build({isCollpased: false});
+ const itemView = TestUtils.renderIntoDocument( <LicenseAgreement laData={laData} /> );
+ expect(itemView).toBeTruthy();
+ const elem = TestUtils.scryRenderedDOMComponentsWithClass(itemView,'right');
+ expect(elem).toBeTruthy();
+ });
+
+ it('renders License Agreement List Item with Children Count', () => {
+ const fgData = FeatureGroupListItemFactory.build();
+ const laData = LicenseAgreementListItemFactory.build({children: [fgData]});
+ const itemView = TestUtils.renderIntoDocument( <LicenseAgreement laData={laData} /> );
+ expect(itemView).toBeTruthy();
+ const elem = scryRenderedDOMComponentsWithTestId(itemView,'vlm-list-fg-count-value');
+ expect(elem).toBeTruthy();
+ expect(elem[0].innerHTML).toBe('1');
+ });
+});
diff --git a/openecomp-ui/test/licenseModel/overview/listItems/LicenseKeyGroup.test.js b/openecomp-ui/test/licenseModel/overview/listItems/LicenseKeyGroup.test.js
new file mode 100644
index 0000000000..b9c097b0b1
--- /dev/null
+++ b/openecomp-ui/test/licenseModel/overview/listItems/LicenseKeyGroup.test.js
@@ -0,0 +1,31 @@
+/*!
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+import React from 'react';
+import TestUtils from 'react-addons-test-utils';
+import LicenseKeyGroup from 'src/sdc-app/onboarding/licenseModel/overview/listItems/LicenseKeyGroup.jsx';
+import {LicenseKeyGroupListItemFactory} from 'test-utils/factories/licenseModel/LicenseKeyGroupFactories.js';
+
+describe('LicenseKeyGroup List Item Module Tests', function () {
+ it('LicenseKeyGroup List Item should exist', () => {
+ expect(LicenseKeyGroup).toBeTruthy();
+ });
+ it('renders LicenseKeyGroup List Item', () => {
+ const lkgData = LicenseKeyGroupListItemFactory.build();
+ const itemView = TestUtils.renderIntoDocument( <LicenseKeyGroup lkgData={lkgData} /> );
+ expect(itemView).toBeTruthy();
+ });
+});
diff --git a/openecomp-ui/test/licenseModel/overview/summary/SummaryCountList.test.js b/openecomp-ui/test/licenseModel/overview/summary/SummaryCountList.test.js
new file mode 100644
index 0000000000..27f7aa68fd
--- /dev/null
+++ b/openecomp-ui/test/licenseModel/overview/summary/SummaryCountList.test.js
@@ -0,0 +1,87 @@
+/*!
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+import React from 'react';
+import TestUtils from 'react-addons-test-utils';
+
+import {mapStateToProps, SummaryCountList} from 'sdc-app/onboarding/licenseModel/overview/summary/SummaryCountList.js';
+import LicenseModelDescriptionEdit from 'sdc-app/onboarding/licenseModel/overview/summary/LicenseModelDescriptionEdit.jsx';
+import {overviewItems} from 'sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewConstants.js';
+import {LicenseModelOverviewFactory, LicenseModelStoreFactory} from 'test-utils/factories/licenseModel/LicenseModelFactories.js';
+
+describe('License Model Overview Summary Count List module test', () => {
+
+ it('should mapper exist', () => {
+ expect(mapStateToProps).toBeTruthy();
+ });
+
+ it('mapper data return test',() => {
+
+ var obj = {
+ licenseModel: LicenseModelOverviewFactory.build({
+ entitlementPool: {
+ entitlementPoolsList: []
+ },
+ licenseAgreement: {
+ licenseAgreementList: []
+ },
+ featureGroup: {
+ featureGroupsList: []
+ },
+ licenseKeyGroup: {
+ licenseKeyGroupsList: []
+ }
+ })
+ };
+
+ let counts = [
+ {name: overviewItems.LICENSE_AGREEMENTS, count: 0},
+ {name: overviewItems.FEATURE_GROUPS, count: 0},
+ {name: overviewItems.ENTITLEMENT_POOLS, count: 0},
+ {name: overviewItems.LICENSE_KEY_GROUPS, count: 0},
+ ];
+
+ var result = mapStateToProps(obj);
+ expect(result.isReadOnlyMode).toEqual(true);
+ expect(result.description).toEqual(obj.licenseModel.licenseModelEditor.data.description);
+ expect(result.counts).toEqual(counts);
+ });
+
+ it('jsx view test', () => {
+
+ var counts = [
+ {name: overviewItems.LICENSE_AGREEMENTS, count: 0},
+ {name: overviewItems.FEATURE_GROUPS, count: 0},
+ {name: overviewItems.ENTITLEMENT_POOLS, count: 0},
+ {name: overviewItems.LICENSE_KEY_GROUPS, count: 0},
+ ];
+
+ var view = TestUtils.renderIntoDocument(<SummaryCountList counts={counts} licenseModelId='1' isReadOnlyMode={false}/>);
+ expect(view).toBeTruthy();
+ });
+
+ it('description editor jsx view test', () => {
+ var data = LicenseModelStoreFactory.build();
+ var genericFieldInfo = {
+ description: {
+ isValid : true
+ }
+ }
+ var view = TestUtils.renderIntoDocument(<LicenseModelDescriptionEdit data={data} genericFieldInfo={genericFieldInfo} description='desc'/>);
+ expect(view).toBeTruthy();
+ });
+
+});
diff --git a/openecomp-ui/test/licenseModel/overview/summary/VendorDataView.test.js b/openecomp-ui/test/licenseModel/overview/summary/VendorDataView.test.js
new file mode 100644
index 0000000000..8fea3e4b90
--- /dev/null
+++ b/openecomp-ui/test/licenseModel/overview/summary/VendorDataView.test.js
@@ -0,0 +1,48 @@
+/*!
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+import React from 'react';
+import TestUtils from 'react-addons-test-utils';
+import {mapStateToProps, VendorDataView} from 'sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js';
+import {LicenseModelOverviewFactory, LicenseModelStoreFactory} from 'test-utils/factories/licenseModel/LicenseModelFactories.js';
+
+
+describe('License Model Overview Summary module test', () => {
+
+ it('should mapper exist', () => {
+ expect(mapStateToProps).toBeTruthy();
+ });
+
+ it('mapper data return test',() => {
+
+ var state = {
+ licenseModel: LicenseModelOverviewFactory.build()
+ };
+
+ var props = mapStateToProps(state);
+ expect(props.isReadOnlyMode).toEqual(true);
+ expect(props.description).toEqual(null);
+ expect(props.data).toEqual(state.licenseModel.licenseModelEditor.data);
+
+ });
+
+ it('jsx view test', () => {
+ var data = LicenseModelStoreFactory.build();
+ var view = TestUtils.renderIntoDocument(<VendorDataView isReadOnlyMode={false} description='' data={data} />);
+ expect(view).toBeTruthy();
+ });
+
+});
diff --git a/openecomp-ui/test/licenseModel/overview/test.js b/openecomp-ui/test/licenseModel/overview/test.js
new file mode 100644
index 0000000000..c78c3e47b1
--- /dev/null
+++ b/openecomp-ui/test/licenseModel/overview/test.js
@@ -0,0 +1,355 @@
+/*!
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+import {mapStateToProps} from 'sdc-app/onboarding/licenseModel/overview/LicenseModelOverview.js';
+import {overviewEditorHeaders, selectedButton} from 'sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewConstants.js';
+
+import {LicenseModelOverviewFactory} from 'test-utils/factories/licenseModel/LicenseModelFactories.js';
+import { EntitlementPoolStoreFactory as EntitlementPool, EntitlementPoolDataListFactory } from 'test-utils/factories/licenseModel/EntitlementPoolFactories.js';
+import { FeatureGroupStoreFactory as FeatureGroup, FeatureGroupDataListFactory} from 'test-utils/factories/licenseModel/FeatureGroupFactories.js';
+import {LicenseAgreementStoreFactory as LicenseAgreement, LicenseAgreementDataListFactory} from 'test-utils/factories/licenseModel/LicenseAgreementFactories.js';
+import { LicenseKeyGroupStoreFactory as LicenseKeyGroup, LicenseKeyGroupDataListFactory} from 'test-utils/factories/licenseModel/LicenseKeyGroupFactories.js';
+
+describe('License Model Overview: ', function () {
+
+ it('should mapper exist', () => {
+ expect(mapStateToProps).toBeTruthy();
+ });
+
+ const VLM1 = LicenseModelOverviewFactory.build();
+
+ it('should mapper return vlm overview basic data', () => {
+ const state = {
+ licenseModel: VLM1
+ };
+
+ var props = mapStateToProps(state);
+ expect(props.isReadOnlyMode).toEqual(true);
+ expect(props.isDisplayModal).toEqual(false);
+ expect(props.modalHeader).toEqual(undefined);
+ expect(props.licenseModelId).toEqual(VLM1.licenseModelEditor.data.id);
+ expect(props.licensingDataList).toEqual([]);
+ expect(props.selectedTab).toEqual(selectedButton.VLM_LIST_VIEW);
+ });
+
+ it('should mapper return overview data for show LA modal', () => {
+ const VLM1 = LicenseModelOverviewFactory.build({
+ licenseAgreement: {
+ licenseAgreementEditor: {
+ data: LicenseAgreement.build()
+ }
+ }
+ });
+
+ var state = {
+ licenseModel: VLM1
+ };
+
+ var props = mapStateToProps(state);
+ expect(props.isReadOnlyMode).toEqual(true);
+ expect(props.isDisplayModal).toEqual(true);
+ expect(props.modalHeader).toEqual(overviewEditorHeaders.LICENSE_AGREEMENT);
+ expect(props.licenseModelId).toEqual(VLM1.licenseModelEditor.data.id);
+ expect(props.licensingDataList).toEqual([]);
+ expect(props.selectedTab).toEqual(selectedButton.VLM_LIST_VIEW);
+ });
+
+ it('should mapper return overview data for show FG modal', () => {
+
+ const VLM1 = LicenseModelOverviewFactory.build({
+ featureGroup: {
+ featureGroupsList: [],
+ featureGroupEditor: {
+ data: FeatureGroup.build()
+ }
+ },
+ entitlementPool: {
+ entitlementPoolsList: []
+ },
+ licenseKeyGroup: {
+ licenseKeyGroupsList: []
+ },
+ licenseModelOverview: {
+ selectedTab: selectedButton.NOT_IN_USE
+ }
+ });
+
+ var state = {
+ licenseModel: VLM1
+ };
+
+ var props = mapStateToProps(state);
+ expect(props.isReadOnlyMode).toEqual(true);
+ expect(props.isDisplayModal).toEqual(true);
+ expect(props.modalHeader).toEqual(overviewEditorHeaders.FEATURE_GROUP);
+ expect(props.licenseModelId).toEqual(VLM1.licenseModelEditor.data.id);
+ expect(props.licensingDataList).toEqual([]);
+ expect(props.selectedTab).toEqual(selectedButton.NOT_IN_USE);
+ });
+
+ it('should mapper return overview data for show EP modal', () => {
+ const VLM1 = LicenseModelOverviewFactory.build({
+ entitlementPool: {
+ entitlementPoolEditor: {
+ data: EntitlementPool.build()
+ }
+ }
+ });
+
+ var state = {
+ licenseModel: VLM1
+ };
+
+ var props = mapStateToProps(state);
+ expect(props.isReadOnlyMode).toEqual(true);
+ expect(props.isDisplayModal).toEqual(true);
+ expect(props.modalHeader).toEqual(overviewEditorHeaders.ENTITLEMENT_POOL);
+ expect(props.licenseModelId).toEqual(VLM1.licenseModelEditor.data.id);
+ expect(props.licensingDataList).toEqual([]);
+ expect(props.selectedTab).toEqual(selectedButton.VLM_LIST_VIEW);
+ });
+
+ it('should mapper return overview data for show LKG modal', () => {
+ const VLM1 = LicenseModelOverviewFactory.build({
+ licenseKeyGroup: {
+ licenseKeyGroupsList: [],
+ licenseKeyGroupsEditor: {
+ data: LicenseKeyGroup.build()
+ }
+ },
+ entitlementPool: {
+ entitlementPoolsList: []
+ },
+ featureGroup: {
+ featureGroupsList: []
+ },
+ licenseModelOverview: {
+ selectedTab: selectedButton.NOT_IN_USE
+ }
+ });
+
+ var state = {
+ licenseModel: VLM1
+ };
+
+ var props = mapStateToProps(state);
+ expect(props.isReadOnlyMode).toEqual(true);
+ expect(props.isDisplayModal).toEqual(true);
+ expect(props.modalHeader).toEqual(overviewEditorHeaders.LICENSE_KEY_GROUP);
+ expect(props.licenseModelId).toEqual(VLM1.licenseModelEditor.data.id);
+ expect(props.licensingDataList).toEqual([]);
+ expect(props.selectedTab).toEqual(selectedButton.NOT_IN_USE);
+ });
+
+ it('should mapper return overview data for Full-hierarchy list view', () => {
+ let EP1 = EntitlementPool.build();
+ let LKG1 = LicenseKeyGroup.build();
+ let FG1 = FeatureGroup.build({
+ entitlementPoolsIds: [EP1.id],
+ licenseKeyGroupsIds: [LKG1.id]
+ });
+ EP1.referencingFeatureGroups = [FG1.id];
+ LKG1.referencingFeatureGroups = [FG1.id];
+ let LA1 = LicenseAgreement.build({
+ featureGroupsIds: [FG1.id]
+ });
+ FG1.referencingLicenseAgreements = LA1.id;
+ let LA2 = LicenseAgreement.build();
+
+ const VLM1 = LicenseModelOverviewFactory.build({
+ licenseAgreement: {
+ licenseAgreementList: [LA1, LA2]
+ },
+ featureGroup: {
+ featureGroupsList: [FG1]
+ },
+ entitlementPool: {
+ entitlementPoolsList: [EP1]
+ },
+ licenseKeyGroup: {
+ licenseKeyGroupsList: [LKG1]
+ },
+ });
+
+ const state = {
+ licenseModel: VLM1
+ };
+
+ const expectedLicensingDataList = [
+ LicenseAgreementDataListFactory.build({
+ ...LA1,
+ children: [
+ FeatureGroupDataListFactory.build({
+ ...FG1,
+ children: [
+ EntitlementPoolDataListFactory.build(EP1),
+ LicenseKeyGroupDataListFactory.build(LKG1)
+ ]
+ })
+ ]
+ }),
+ LicenseAgreementDataListFactory.build(LA2)
+ ];
+
+ var props = mapStateToProps(state);
+
+ expect(props.isReadOnlyMode).toEqual(true);
+ expect(props.isDisplayModal).toEqual(false);
+ expect(props.modalHeader).toEqual(undefined);
+ expect(props.licenseModelId).toEqual(VLM1.licenseModelEditor.data.id);
+ expect(props.licensingDataList).toEqual(expectedLicensingDataList);
+ expect(props.selectedTab).toEqual(selectedButton.VLM_LIST_VIEW);
+ });
+
+ it('should mapper return overview data for list view with 2 levels', () => {
+ let EP1 = EntitlementPool.build();
+ let LKG1 = LicenseKeyGroup.build();
+ let FG1 = FeatureGroup.build();
+ let LA1 = LicenseAgreement.build({
+ featureGroupsIds: [FG1.id]
+ });
+ let LA2 = LicenseAgreement.build();
+ FG1.referencingLicenseAgreements = [LA1.id];
+
+ const VLM1 = LicenseModelOverviewFactory.build({
+ licenseAgreement: {
+ licenseAgreementList: [LA1, LA2]
+ },
+ featureGroup: {
+ featureGroupsList: [FG1]
+ },
+ entitlementPool: {
+ entitlementPoolsList: [EP1]
+ },
+ licenseKeyGroup: {
+ licenseKeyGroupsList: [LKG1]
+ },
+ });
+
+ const state = {
+ licenseModel: VLM1
+ };
+
+ const expectedLicensingDataList = [
+ LicenseAgreementDataListFactory.build({
+ ...LA1,
+ children: [
+ FeatureGroupDataListFactory.build(FG1)
+ ]
+ }),
+ LicenseAgreementDataListFactory.build(LA2)
+ ];
+
+ var props = mapStateToProps(state);
+
+ expect(props.isReadOnlyMode).toEqual(true);
+ expect(props.isDisplayModal).toEqual(false);
+ expect(props.modalHeader).toEqual(undefined);
+ expect(props.licenseModelId).toEqual(VLM1.licenseModelEditor.data.id);
+ expect(props.licensingDataList).toEqual(expectedLicensingDataList);
+ expect(props.selectedTab).toEqual(selectedButton.VLM_LIST_VIEW);
+ });
+
+ it('should mapper return overview data for Full NOT-IN-USE list view', () => {
+ let EP1 = EntitlementPool.build();
+ let LKG1 = LicenseKeyGroup.build();
+ let FG1 = FeatureGroup.build();
+
+ const VLM1 = LicenseModelOverviewFactory.build({
+ licenseAgreement: { licenseAgreementList: [] },
+ featureGroup: {
+ featureGroupsList: [FG1]
+ },
+ entitlementPool: {
+ entitlementPoolsList: [EP1]
+ },
+ licenseKeyGroup: {
+ licenseKeyGroupsList: [LKG1]
+ },
+ licenseModelOverview: {
+ selectedTab: selectedButton.NOT_IN_USE
+ }
+ });
+
+ const state = {
+ licenseModel: VLM1
+ };
+
+ const expectedLicensingDataList = [
+ FeatureGroupDataListFactory.build(FG1),
+ EntitlementPoolDataListFactory.build(EP1),
+ LicenseKeyGroupDataListFactory.build(LKG1)
+ ];
+
+ var props = mapStateToProps(state);
+
+ expect(props.isReadOnlyMode).toEqual(true);
+ expect(props.isDisplayModal).toEqual(false);
+ expect(props.modalHeader).toEqual(undefined);
+ expect(props.licenseModelId).toEqual(VLM1.licenseModelEditor.data.id);
+ expect(props.licensingDataList).toEqual(expectedLicensingDataList);
+ expect(props.selectedTab).toEqual(selectedButton.NOT_IN_USE);
+ });
+
+ it('should mapper return overview data for NOT-IN-USE list view (FG with children)', () => {
+ let EP1 = EntitlementPool.build();
+ let LKG1 = LicenseKeyGroup.build();
+ let FG1 = FeatureGroup.build({
+ entitlementPoolsIds: [EP1.id],
+ licenseKeyGroupsIds: [LKG1.id]
+ });
+ EP1.referencingFeatureGroups = [FG1.id];
+ LKG1.referencingFeatureGroups = [FG1.id];
+
+ const VLM1 = LicenseModelOverviewFactory.build({
+ licenseAgreement: { licenseAgreementList: [] },
+ featureGroup: {
+ featureGroupsList: [FG1]
+ },
+ entitlementPool: {
+ entitlementPoolsList: [EP1]
+ },
+ licenseKeyGroup: {
+ licenseKeyGroupsList: [LKG1]
+ },
+ licenseModelOverview: {
+ selectedTab: selectedButton.NOT_IN_USE
+ }
+ });
+
+ const state = {
+ licenseModel: VLM1
+ };
+
+ const expectedLicensingDataList = [
+ FeatureGroupDataListFactory.build({
+ ...FG1,
+ children: [
+ EntitlementPoolDataListFactory.build(EP1),
+ LicenseKeyGroupDataListFactory.build(LKG1)]
+ })
+ ];
+
+ var props = mapStateToProps(state);
+
+ expect(props.isReadOnlyMode).toEqual(true);
+ expect(props.isDisplayModal).toEqual(false);
+ expect(props.modalHeader).toEqual(undefined);
+ expect(props.licenseModelId).toEqual(VLM1.licenseModelEditor.data.id);
+ expect(props.licensingDataList).toEqual(expectedLicensingDataList);
+ expect(props.selectedTab).toEqual(selectedButton.NOT_IN_USE);
+ });
+});
diff --git a/openecomp-ui/test/licenseModel/overview/views.test.js b/openecomp-ui/test/licenseModel/overview/views.test.js
new file mode 100644
index 0000000000..4a38afccca
--- /dev/null
+++ b/openecomp-ui/test/licenseModel/overview/views.test.js
@@ -0,0 +1,159 @@
+/*!
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+import React from 'react';
+import TestUtils from 'react-addons-test-utils';
+import {scryRenderedDOMComponentsWithTestId} from 'test-utils/Util.js';
+import SummaryView from 'sdc-app/onboarding/licenseModel/overview/SummaryView.jsx';
+import LicenseModelOverviewView from 'sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx';
+import VLMListView from 'sdc-app/onboarding/licenseModel/overview/VLMListView.jsx';
+import {selectedButton} from 'sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewConstants.js';
+
+import {FeatureGroupListItemFactory} from 'test-utils/factories/licenseModel/FeatureGroupFactories.js';
+import {EntitlementPoolListItemFactory} from 'test-utils/factories/licenseModel/EntitlementPoolFactories.js';
+import {LicenseKeyGroupListItemFactory} from 'test-utils/factories/licenseModel/LicenseKeyGroupFactories.js';
+import {LicenseAgreementListItemFactory} from 'test-utils/factories/licenseModel/LicenseAgreementFactories.js';
+
+describe('License Model Overview - View: ', function () {
+
+ const lkgChild = LicenseKeyGroupListItemFactory.build();
+
+ const epChild = EntitlementPoolListItemFactory.build();
+
+ const baseFGData = FeatureGroupListItemFactory.build({isCollapsed: false});
+ const baseLAData = LicenseAgreementListItemFactory.build({isCollapse: false});
+
+ it('should render SummaryView', () => {
+ var renderer = TestUtils.createRenderer();
+ renderer.render(
+ <SummaryView />
+ );
+ let renderedOutput = renderer.getRenderOutput();
+ expect(renderedOutput).toBeTruthy();
+ });
+
+ it('should render LicenseModelOverviewView', () => {
+ let fgData = {...baseFGData};
+ fgData.children = Array.of(epChild, lkgChild);
+ let laData = {...baseLAData};
+ laData.children = [fgData];
+
+ const params = {
+ licenseModelId: 'VLM1',
+ isDisplayModal: false,
+ modalHeader: undefined,
+ licensingDataList: [laData],
+ selectedTab: selectedButton.VLM_LIST_VIEW,
+ onTabSelect: () => {}
+ };
+ var renderer = TestUtils.createRenderer();
+ renderer.render(
+ <LicenseModelOverviewView {...params}/>
+ );
+ let renderedOutput = renderer.getRenderOutput();
+ expect(renderedOutput).toBeTruthy();
+ });
+
+
+ it('should render empty VLMListView', () => {
+ const listview = TestUtils.renderIntoDocument( <VLMListView /> );
+ expect(listview).toBeTruthy();
+ const elem = scryRenderedDOMComponentsWithTestId(listview,'vlm-list');
+ expect(elem).toBeTruthy();
+ expect(elem[0].children.length).toBe(0);
+ });
+
+ it('should render VLMListView with licenseAgreement', () => {
+ const listview = TestUtils.renderIntoDocument( <VLMListView licensingDataList={[baseLAData]}/> );
+ expect(listview).toBeTruthy();
+ let elem = scryRenderedDOMComponentsWithTestId(listview,'vlm-list');
+ expect(elem).toBeTruthy();
+ expect(elem[0].children.length).toBe(1);
+ elem = scryRenderedDOMComponentsWithTestId(listview,'vlm-list-la-item');
+ expect(elem).toBeTruthy();
+ expect(elem.length).toBe(1);
+ });
+
+ it('should render VLMListView with Feature Group', () => {
+ let laData = {...baseLAData};
+ laData.children = [baseFGData];
+ const listview = TestUtils.renderIntoDocument( <VLMListView licensingDataList={[laData]}/> );
+ expect(listview).toBeTruthy();
+ const elem = scryRenderedDOMComponentsWithTestId(listview,'vlm-list-item-fg');
+ expect(elem).toBeTruthy();
+ expect(elem.length).toBe(1);
+ });
+
+ it('should render VLMListView with Entitlement Pool', () => {
+ let fgData = {...baseFGData};
+ fgData.children = [epChild];
+ let laData = {...baseLAData};
+ laData.children = [fgData];
+
+ const listview = TestUtils.renderIntoDocument( <VLMListView licensingDataList={[laData]} showInUse={true} /> );
+ expect(listview).toBeTruthy();
+ const elem = scryRenderedDOMComponentsWithTestId(listview,'vlm-list-item-ep');
+ expect(elem).toBeTruthy();
+ expect(elem.length).toBe(1);
+ });
+
+ it('should render VLMListView with LicenseKeyGroup', () => {
+ let fgData = {...baseFGData};
+ fgData.children = [lkgChild];
+ let laData = {...baseLAData};
+ laData.children = [fgData];
+
+ const listview = TestUtils.renderIntoDocument( <VLMListView licensingDataList={[laData]} showInUse={true} /> );
+ expect(listview).toBeTruthy();
+ const elem = scryRenderedDOMComponentsWithTestId(listview,'vlm-list-item-lkg');
+ expect(elem).toBeTruthy();
+ expect(elem.length).toBe(1);
+ });
+
+ it('should render VLMListView with all items', () => {
+ let fgData = {...baseFGData};
+ fgData.children = Array.of(epChild, lkgChild);
+ let laData = {...baseLAData};
+ laData.children = [fgData];
+
+ const listview = TestUtils.renderIntoDocument( <VLMListView licensingDataList={[laData]} showInUse={true} /> );
+ expect(listview).toBeTruthy();
+ let elem = scryRenderedDOMComponentsWithTestId(listview,'vlm-list-item-fg');
+ expect(elem).toBeTruthy();
+ expect(elem.length).toBe(1);
+ elem = scryRenderedDOMComponentsWithTestId(listview,'vlm-list-item-lkg');
+ expect(elem).toBeTruthy();
+ expect(elem.length).toBe(1);
+ elem = scryRenderedDOMComponentsWithTestId(listview,'vlm-list-item-ep');
+ expect(elem).toBeTruthy();
+ expect(elem.length).toBe(1);
+ });
+
+ it('should update collapsing item', () => {
+ let fgData = {...baseFGData};
+ fgData.children = Array.of(epChild, lkgChild);
+ let laData = {...baseLAData};
+ laData.children = [fgData];
+
+ var renderer = TestUtils.renderIntoDocument(
+ <VLMListView licensingDataList={[laData]} showInUse={true}/>
+ );
+ expect(renderer).toBeTruthy();
+
+ renderer.updateCollapsable(new Event('click'), 'LA1');
+ expect(renderer.state['LA1']).toEqual(true);
+ });
+});