aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-ui/test/licenseModel
diff options
context:
space:
mode:
authortalig <talig@amdocs.com>2017-12-20 14:30:43 +0200
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-12-21 11:12:33 +0000
commit8e9c0653dd6c6862123c9609ae34e1206d86456e (patch)
tree5eeef00ec0677133baa439ca8d7ffd7aca4804b6 /openecomp-ui/test/licenseModel
parent785ebcc95de3e064e843bec04ba7a209d854fc7c (diff)
Add collaboration feature
Issue-ID: SDC-767 Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795 Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-ui/test/licenseModel')
-rw-r--r--openecomp-ui/test/licenseModel/creation/LicenseModelCreation.test.js10
-rw-r--r--openecomp-ui/test/licenseModel/entitlementPools/test.js129
-rw-r--r--openecomp-ui/test/licenseModel/featureGroups/test.js84
-rw-r--r--openecomp-ui/test/licenseModel/licenseAgreement/test.js65
-rw-r--r--openecomp-ui/test/licenseModel/licenseKeyGroups/test.js130
-rw-r--r--openecomp-ui/test/licenseModel/overview/summary/SummaryCountList.test.js3
-rw-r--r--openecomp-ui/test/licenseModel/overview/summary/VendorDataView.test.js3
-rw-r--r--openecomp-ui/test/licenseModel/overview/test.js13
-rw-r--r--openecomp-ui/test/licenseModel/overview/views.test.js2
-rw-r--r--openecomp-ui/test/licenseModel/test.js96
10 files changed, 474 insertions, 61 deletions
diff --git a/openecomp-ui/test/licenseModel/creation/LicenseModelCreation.test.js b/openecomp-ui/test/licenseModel/creation/LicenseModelCreation.test.js
index 0d8ce945c8..935360b04b 100644
--- a/openecomp-ui/test/licenseModel/creation/LicenseModelCreation.test.js
+++ b/openecomp-ui/test/licenseModel/creation/LicenseModelCreation.test.js
@@ -32,6 +32,9 @@ describe('License Model Creation Module Tests', function() {
licenseModelCreation: {
data: {}
}
+ },
+ users: {
+ usersList: []
}
};
let props = mapStateToProps(state);
@@ -41,16 +44,19 @@ describe('License Model Creation Module Tests', function() {
it ('should return vlm names list', () => {
let state = {
licenseModelList: [{
- vendorName: 'vlm1',
+ name: 'vlm1',
id: 'vlm1_id'
}, {
- vendorName: 'vlm2',
+ name: 'vlm2',
id: 'vlm2_id'
}],
licenseModel: {
licenseModelCreation: {
data: {}
}
+ },
+ users: {
+ usersList: []
}
};
let props = mapStateToProps(state);
diff --git a/openecomp-ui/test/licenseModel/entitlementPools/test.js b/openecomp-ui/test/licenseModel/entitlementPools/test.js
index f5415239ad..173384dc02 100644
--- a/openecomp-ui/test/licenseModel/entitlementPools/test.js
+++ b/openecomp-ui/test/licenseModel/entitlementPools/test.js
@@ -19,14 +19,18 @@ import {cloneAndSet, buildListFromFactory} from 'test-utils/Util.js';
import {storeCreator} from 'sdc-app/AppStore.js';
import EntitlementPoolsActionHelper from 'sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js';
import {EntitlementPoolStoreFactory, EntitlementPoolPostFactory} from 'test-utils/factories/licenseModel/EntitlementPoolFactories.js';
-import VersionControllerUtilsFactory from 'test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js';
+import VersionFactory from 'test-utils/factories/common/VersionFactory.js';
import {LimitItemFactory, LimitPostFactory} from 'test-utils/factories/licenseModel/LimitFactories.js';
import {getStrValue} from 'nfvo-utils/getValue.js';
+import {SyncStates} from 'sdc-app/common/merge/MergeEditorConstants.js';
+import CurrentScreenFactory from 'test-utils/factories/common/CurrentScreenFactory.js';
describe('Entitlement Pools Module Tests', function () {
const LICENSE_MODEL_ID = '555';
- const version = VersionControllerUtilsFactory.build().version;
+ const version = VersionFactory.build();
+ const itemPermissionAndProps = CurrentScreenFactory.build({}, {version});
+ const returnedVersionFields = {baseId: version.baseId, description: version.description, id: version.id, name: version.name, status: version.status};
it('Load Entitlement Pools List', () => {
@@ -54,6 +58,7 @@ describe('Entitlement Pools Module Tests', function () {
const entitlementPoolsList = buildListFromFactory(EntitlementPoolStoreFactory,1);
deepFreeze(entitlementPoolsList);
const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps},
licenseModel: {
entitlementPool: {
entitlementPoolsList
@@ -62,7 +67,16 @@ describe('Entitlement Pools Module Tests', function () {
});
deepFreeze(store.getState());
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolsList', []);
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
+
+ let expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolsList', []);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
mockRest.addHandler('destroy', ({data, options, baseUrl}) => {
expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/entitlement-pools/${entitlementPoolsList[0].id}`);
@@ -75,6 +89,13 @@ describe('Entitlement Pools Module Tests', function () {
};
});
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
+ });
+
return EntitlementPoolsActionHelper.deleteEntitlementPool(store.dispatch, {
licenseModelId: LICENSE_MODEL_ID,
version,
@@ -86,7 +107,9 @@ describe('Entitlement Pools Module Tests', function () {
it('Add Entitlement Pool', () => {
- const store = storeCreator();
+ const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps}
+ });
deepFreeze(store.getState());
const EntitlementPoolPostRequest = EntitlementPoolPostFactory.build();
@@ -97,7 +120,16 @@ describe('Entitlement Pools Module Tests', function () {
const entitlementPoolAfterAdd = EntitlementPoolStoreFactory.build({id: entitlementPoolIdFromResponse});
deepFreeze(entitlementPoolAfterAdd);
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolsList', [entitlementPoolAfterAdd]);
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
+
+ let expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolsList', [entitlementPoolAfterAdd]);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
mockRest.addHandler('post', ({data, options, baseUrl}) => {
expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/entitlement-pools`);
@@ -109,6 +141,13 @@ describe('Entitlement Pools Module Tests', function () {
};
});
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
+ });
+
return EntitlementPoolsActionHelper.saveEntitlementPool(store.dispatch,
{
licenseModelId: LICENSE_MODEL_ID,
@@ -127,6 +166,7 @@ describe('Entitlement Pools Module Tests', function () {
deepFreeze(entitlementPoolsList);
const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps},
licenseModel: {
entitlementPool: {
entitlementPoolsList
@@ -144,7 +184,16 @@ describe('Entitlement Pools Module Tests', function () {
const entitlementPoolPutRequest = EntitlementPoolPostFactory.build({name: 'ep1_UPDATED', description: 'string_UPDATED'});
deepFreeze(entitlementPoolPutRequest);
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolsList', [entitlementPoolUpdateData]);
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
+
+ let expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolsList', [entitlementPoolUpdateData]);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
mockRest.addHandler('put', ({data, options, baseUrl}) => {
@@ -154,6 +203,13 @@ describe('Entitlement Pools Module Tests', function () {
return {returnCode: 'OK'};
});
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
+ });
+
return EntitlementPoolsActionHelper.saveEntitlementPool(store.dispatch, {
licenseModelId: LICENSE_MODEL_ID,
version,
@@ -187,7 +243,9 @@ describe('Entitlement Pools Module Tests', function () {
it('Add Limit', () => {
- const store = storeCreator();
+ const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps}
+ });
deepFreeze(store.getState());
const limitToAdd = LimitPostFactory.build();
@@ -203,7 +261,16 @@ describe('Entitlement Pools Module Tests', function () {
deepFreeze(limitAddedItem);
const entitlementPool = EntitlementPoolStoreFactory.build();
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolEditor.limitsList', [limitAddedItem]);
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
+
+ let expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolEditor.limitsList', [limitAddedItem]);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
mockRest.addHandler('post', ({data, options, baseUrl}) => {
expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/entitlement-pools/${entitlementPool.id}/limits`);
@@ -222,6 +289,13 @@ describe('Entitlement Pools Module Tests', function () {
return {results: [limitAddedItem]};
});
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
+ });
+
return EntitlementPoolsActionHelper.submitLimit(store.dispatch,
{
licenseModelId: LICENSE_MODEL_ID,
@@ -241,6 +315,7 @@ describe('Entitlement Pools Module Tests', function () {
deepFreeze(limitsList);
const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps},
licenseModel: {
entitlementPool: {
entitlementPoolEditor: {
@@ -252,7 +327,17 @@ describe('Entitlement Pools Module Tests', function () {
deepFreeze(store.getState());
const entitlementPool = EntitlementPoolStoreFactory.build();
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolEditor.limitsList', []);
+
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
+
+ let expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolEditor.limitsList', []);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
mockRest.addHandler('destroy', ({data, options, baseUrl}) => {
expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/entitlement-pools/${entitlementPool.id}/limits/${limitsList[0].id}`);
@@ -272,6 +357,13 @@ describe('Entitlement Pools Module Tests', function () {
return {results: []};
});
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
+ });
+
return EntitlementPoolsActionHelper.deleteLimit(store.dispatch, {
licenseModelId: LICENSE_MODEL_ID,
version,
@@ -288,6 +380,7 @@ describe('Entitlement Pools Module Tests', function () {
deepFreeze(limitsList);
const entitlementPool = EntitlementPoolStoreFactory.build();
const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps},
licenseModel: {
entitlementPool: {
entitlementPoolEditor: {
@@ -312,7 +405,16 @@ describe('Entitlement Pools Module Tests', function () {
updatedLimit.unit = {choice: updatedLimit.unit, other: ''};
deepFreeze(updatedLimit);
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolEditor.limitsList', [updatedLimitForPut]);
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
+
+ let expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolEditor.limitsList', [updatedLimitForPut]);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
mockRest.addHandler('put', ({data, options, baseUrl}) => {
@@ -329,6 +431,13 @@ describe('Entitlement Pools Module Tests', function () {
return {results: [updatedLimitForPut]};
});
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
+ });
+
return EntitlementPoolsActionHelper.submitLimit(store.dispatch,
{
licenseModelId: LICENSE_MODEL_ID,
diff --git a/openecomp-ui/test/licenseModel/featureGroups/test.js b/openecomp-ui/test/licenseModel/featureGroups/test.js
index 7d0d7242b5..eb947b83d0 100644
--- a/openecomp-ui/test/licenseModel/featureGroups/test.js
+++ b/openecomp-ui/test/licenseModel/featureGroups/test.js
@@ -19,13 +19,17 @@ import {cloneAndSet, buildListFromFactory} from 'test-utils/Util.js';
import {storeCreator} from 'sdc-app/AppStore.js';
import FeatureGroupsActionHelper from 'sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js';
import { FeatureGroupStoreFactory, FeatureGroupPostFactory, FeatureGroupDispatchFactory, FeatureGroupPutFactory } from 'test-utils/factories/licenseModel/FeatureGroupFactories.js';
-import VersionControllerUtilsFactory from 'test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js';
+import VersionFactory from 'test-utils/factories/common/VersionFactory.js';
+import CurrentScreenFactory from 'test-utils/factories/common/CurrentScreenFactory.js';
+import {SyncStates} from 'sdc-app/common/merge/MergeEditorConstants.js';
describe('Feature Groups Module Tests', function () {
const LICENSE_MODEL_ID = '555';
- const version = VersionControllerUtilsFactory.build().version;
+ const version = VersionFactory.build();
+ const itemPermissionAndProps = CurrentScreenFactory.build({}, {version});
+ const returnedVersionFields = {baseId: version.baseId, description: version.description, id: version.id, name: version.name, status: version.status};
it('Load Feature Groups List', () => {
@@ -53,6 +57,7 @@ describe('Feature Groups Module Tests', function () {
const featureGroupsList = buildListFromFactory(FeatureGroupStoreFactory, 1);
deepFreeze(featureGroupsList);
const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps},
licenseModel: {
featureGroup: {
featureGroupsList
@@ -61,7 +66,16 @@ describe('Feature Groups Module Tests', function () {
});
deepFreeze(store.getState());
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.featureGroup.featureGroupsList', []);
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
+
+ let expectedStore = cloneAndSet(store.getState(), 'licenseModel.featureGroup.featureGroupsList', []);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
const idToDelete = featureGroupsList[0].id;
@@ -76,6 +90,13 @@ describe('Feature Groups Module Tests', function () {
};
});
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
+ });
+
return FeatureGroupsActionHelper.deleteFeatureGroup(store.dispatch, {
licenseModelId: LICENSE_MODEL_ID,
version,
@@ -87,7 +108,14 @@ describe('Feature Groups Module Tests', function () {
it('Add Feature Group', () => {
- const store = storeCreator();
+ const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps},
+ licenseModel: {
+ featureGroup: {
+ featureGroupsList: []
+ }
+ }
+ });
deepFreeze(store.getState());
const FeatureGroupPostRequest = FeatureGroupPostFactory.build({
@@ -105,7 +133,16 @@ describe('Feature Groups Module Tests', function () {
id: featureGroupIdFromResponse
});
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.featureGroup.featureGroupsList', [featureGroupAfterAdd]);
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
+
+ let expectedStore = cloneAndSet(store.getState(), 'licenseModel.featureGroup.featureGroupsList', [featureGroupAfterAdd]);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
mockRest.addHandler('post', ({data, options, baseUrl}) => {
expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/feature-groups`);
@@ -131,6 +168,13 @@ describe('Feature Groups Module Tests', function () {
return {results: []};
});
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
+ });
+
return FeatureGroupsActionHelper.saveFeatureGroup(store.dispatch, {
licenseModelId: LICENSE_MODEL_ID,
@@ -149,6 +193,7 @@ describe('Feature Groups Module Tests', function () {
deepFreeze(featureGroupsList);
const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps},
licenseModel: {
featureGroup: {
featureGroupsList
@@ -178,7 +223,16 @@ describe('Feature Groups Module Tests', function () {
});
deepFreeze(FeatureGroupPutFactoryRequest);
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.featureGroup.featureGroupsList', [featureGroupUpdateData]);
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
+
+ let expectedStore = cloneAndSet(store.getState(), 'licenseModel.featureGroup.featureGroupsList', [featureGroupUpdateData]);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
mockRest.addHandler('put', ({data, options, baseUrl}) => {
@@ -202,6 +256,13 @@ describe('Feature Groups Module Tests', function () {
return {results: []};
});
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
+ });
+
return FeatureGroupsActionHelper.saveFeatureGroup(store.dispatch, {
licenseModelId: LICENSE_MODEL_ID,
version,
@@ -220,7 +281,6 @@ describe('Feature Groups Module Tests', function () {
const editorData = FeatureGroupStoreFactory.build();
deepFreeze(editorData);
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.featureGroup.featureGroupEditor.data', editorData);
const LICENSE_MODEL_ID = '123';
mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
@@ -238,13 +298,9 @@ describe('Feature Groups Module Tests', function () {
});
- FeatureGroupsActionHelper.openFeatureGroupsEditor(store.dispatch, {featureGroup: editorData, licenseModelId: '123', version});
- setTimeout(() =>{
- expect(store.getState()).toEqual(expectedStore);
- }, 100);
-
-
-
+ return FeatureGroupsActionHelper.openFeatureGroupsEditor(store.dispatch, {featureGroup: editorData, licenseModelId: '123', version}).then(() => {
+ expect(store.getState().licenseModel.featureGroup.featureGroupEditor.data).toEqual(editorData);
+ });
});
});
diff --git a/openecomp-ui/test/licenseModel/licenseAgreement/test.js b/openecomp-ui/test/licenseModel/licenseAgreement/test.js
index 40b60da77f..11dc7edde5 100644
--- a/openecomp-ui/test/licenseModel/licenseAgreement/test.js
+++ b/openecomp-ui/test/licenseModel/licenseAgreement/test.js
@@ -21,12 +21,16 @@ import {storeCreator} from 'sdc-app/AppStore.js';
import LicenseAgreementActionHelper from 'sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementActionHelper.js';
import { LicenseAgreementStoreFactory, LicenseAgreementDispatchFactory, LicenseAgreementPostFactory, LicenseAgreementPutFactory } from 'test-utils/factories/licenseModel/LicenseAgreementFactories.js';
-import VersionControllerUtilsFactory from 'test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js';
+import VersionFactory from 'test-utils/factories/common/VersionFactory.js';
+import {SyncStates} from 'sdc-app/common/merge/MergeEditorConstants.js';
+import CurrentScreenFactory from 'test-utils/factories/common/CurrentScreenFactory.js';
describe('License Agreement Module Tests', () => {
const LICENSE_MODEL_ID = '777';
- const version = VersionControllerUtilsFactory.build().version;
+ const version = VersionFactory.build();
+ const itemPermissionAndProps = CurrentScreenFactory.build({}, {version});
+ const returnedVersionFields = {baseId: version.baseId, description: version.description, id: version.id, name: version.name, status: version.status};
it('Load License Agreement List', () => {
const licenseAgreementList = buildListFromFactory(LicenseAgreementStoreFactory);
@@ -50,6 +54,7 @@ describe('License Agreement Module Tests', () => {
it('Delete License Agreement', () => {
const licenseAgreementList = buildListFromFactory(LicenseAgreementStoreFactory, 1);
const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps},
licenseModel: {
licenseAgreement: {
licenseAgreementList
@@ -57,14 +62,28 @@ describe('License Agreement Module Tests', () => {
}
});
deepFreeze(store.getState());
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
const toBeDeletedLicenseAgreementId = licenseAgreementList[0].id;
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseAgreement.licenseAgreementList', []);
+ let expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseAgreement.licenseAgreementList', []);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
mockRest.addHandler('destroy', ({data, options, baseUrl}) => {
expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-agreements/${toBeDeletedLicenseAgreementId}`);
expect(data).toEqual(undefined);
expect(options).toEqual(undefined);
});
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
+ });
return LicenseAgreementActionHelper.deleteLicenseAgreement(store.dispatch, {
licenseAgreementId: toBeDeletedLicenseAgreementId,
@@ -76,7 +95,9 @@ describe('License Agreement Module Tests', () => {
});
it('Add License Agreement', () => {
- const store = storeCreator();
+ const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps}
+ });
deepFreeze(store.getState());
const licenseAgreementToAdd = LicenseAgreementDispatchFactory.build();
@@ -94,9 +115,16 @@ describe('License Agreement Module Tests', () => {
});
deepFreeze(licenseAgreementAfterAdd);
const licenseAgreementList = [licenseAgreementAfterAdd];
-
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
const featureGroupsList = licenseAgreementList.featureGroupsIds;
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseAgreement.licenseAgreementList', [licenseAgreementAfterAdd]);
+ let expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseAgreement.licenseAgreementList', [licenseAgreementAfterAdd]);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
mockRest.addHandler('post', ({options, data, baseUrl}) => {
expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-agreements`);
@@ -118,6 +146,13 @@ describe('License Agreement Module Tests', () => {
expect(options).toEqual(undefined);
return {results: featureGroupsList};
});
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
+
+ });
return LicenseAgreementActionHelper.saveLicenseAgreement(store.dispatch, {
licenseAgreement: licenseAgreementToAdd,
licenseModelId: LICENSE_MODEL_ID,
@@ -130,6 +165,7 @@ describe('License Agreement Module Tests', () => {
it('Update License Agreement', () => {
const licenseAgreementList = buildListFromFactory(LicenseAgreementStoreFactory, 1, {featureGroupsIds: ['77']});
const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps},
licenseModel: {
licenseAgreement: {
licenseAgreementList
@@ -157,7 +193,15 @@ describe('License Agreement Module Tests', () => {
deepFreeze(LicenseAgreementPutFactoryRequest);
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseAgreement.licenseAgreementList', [licenseAgreementUpdateData]);
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
+ let expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseAgreement.licenseAgreementList', [licenseAgreementUpdateData]);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
mockRest.addHandler('put', ({data, options, baseUrl}) => {
expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-agreements/${toBeUpdatedLicenseAgreementId}`);
@@ -170,12 +214,19 @@ describe('License Agreement Module Tests', () => {
expect(options).toEqual(undefined);
return {results: [licenseAgreementUpdateData]};
});
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
+ });
mockRest.addHandler('fetch', ({options, data, baseUrl}) => {
expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/feature-groups`);
expect(data).toEqual(undefined);
expect(options).toEqual(undefined);
return {results: newFeatureGroupsIds};
});
+
return LicenseAgreementActionHelper.saveLicenseAgreement(store.dispatch, {
licenseModelId: LICENSE_MODEL_ID,
version,
diff --git a/openecomp-ui/test/licenseModel/licenseKeyGroups/test.js b/openecomp-ui/test/licenseModel/licenseKeyGroups/test.js
index 739e266d7f..09a2c6f53a 100644
--- a/openecomp-ui/test/licenseModel/licenseKeyGroups/test.js
+++ b/openecomp-ui/test/licenseModel/licenseKeyGroups/test.js
@@ -20,14 +20,18 @@ import {storeCreator} from 'sdc-app/AppStore.js';
import {LicenseKeyGroupStoreFactory, LicenseKeyGroupPostFactory} from 'test-utils/factories/licenseModel/LicenseKeyGroupFactories.js';
import LicenseKeyGroupsActionHelper from 'sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js';
-import VersionControllerUtilsFactory from 'test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js';
+import VersionFactory from 'test-utils/factories/common/VersionFactory.js';
+import CurrentScreenFactory from 'test-utils/factories/common/CurrentScreenFactory.js';
import {LimitItemFactory, LimitPostFactory} from 'test-utils/factories/licenseModel/LimitFactories.js';
import {getStrValue} from 'nfvo-utils/getValue.js';
+import {SyncStates} from 'sdc-app/common/merge/MergeEditorConstants.js';
describe('License Key Groups Module Tests', function () {
const LICENSE_MODEL_ID = '555';
- const version = VersionControllerUtilsFactory.build().version;
+ const version = VersionFactory.build();
+ const itemPermissionAndProps = CurrentScreenFactory.build({}, {version});
+ const returnedVersionFields = {baseId: version.baseId, description: version.description, id: version.id, name: version.name, status: version.status};
it('Load License Key Group', () => {
@@ -57,6 +61,7 @@ describe('License Key Groups Module Tests', function () {
deepFreeze(licenseKeyGroupsList);
const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps},
licenseModel: {
licenseKeyGroup: {
licenseKeyGroupsList
@@ -65,7 +70,17 @@ describe('License Key Groups Module Tests', function () {
});
deepFreeze(store.getState());
const toBeDeletedLicenseKeyGroupId = licenseKeyGroupsList[0].id;
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseKeyGroup.licenseKeyGroupsList', []);
+
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
+
+ let expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseKeyGroup.licenseKeyGroupsList', []);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
mockRest.addHandler('destroy', ({data, options, baseUrl}) => {
expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-key-groups/${toBeDeletedLicenseKeyGroupId}`);
@@ -73,6 +88,13 @@ describe('License Key Groups Module Tests', function () {
expect(options).toEqual(undefined);
});
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
+ });
+
return LicenseKeyGroupsActionHelper.deleteLicenseKeyGroup(store.dispatch, {
licenseKeyGroupId: toBeDeletedLicenseKeyGroupId,
licenseModelId: LICENSE_MODEL_ID,
@@ -84,7 +106,9 @@ describe('License Key Groups Module Tests', function () {
it('Add License Key Group', () => {
- const store = storeCreator();
+ const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps}
+ });
deepFreeze(store.getState());
const LicenseKeyGroupPost = LicenseKeyGroupPostFactory.build();
@@ -93,7 +117,16 @@ describe('License Key Groups Module Tests', function () {
const LicenseKeyGroupStore = LicenseKeyGroupStoreFactory.build();
deepFreeze(LicenseKeyGroupStore);
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseKeyGroup.licenseKeyGroupsList', [LicenseKeyGroupStore]);
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
+
+ let expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseKeyGroup.licenseKeyGroupsList', [LicenseKeyGroupStore]);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
mockRest.addHandler('post', ({options, data, baseUrl}) => {
expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-key-groups`);
@@ -104,6 +137,13 @@ describe('License Key Groups Module Tests', function () {
};
});
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
+ });
+
return LicenseKeyGroupsActionHelper.saveLicenseKeyGroup(store.dispatch, {
licenseKeyGroup: LicenseKeyGroupPost,
licenseModelId: LICENSE_MODEL_ID,
@@ -117,6 +157,7 @@ describe('License Key Groups Module Tests', function () {
const licenseKeyGroupsList = buildListFromFactory(LicenseKeyGroupStoreFactory, 1);
deepFreeze(licenseKeyGroupsList);
const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps},
licenseModel: {
licenseKeyGroup: {
licenseKeyGroupsList
@@ -141,7 +182,16 @@ describe('License Key Groups Module Tests', function () {
deepFreeze(licenseKeyGroupPutRequest);
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseKeyGroup.licenseKeyGroupsList', [licenseKeyGroupUpdatedData]);
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
+
+ let expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseKeyGroup.licenseKeyGroupsList', [licenseKeyGroupUpdatedData]);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
mockRest.addHandler('put', ({data, options, baseUrl}) => {
expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-key-groups/${toBeUpdatedLicenseKeyGroupId}`);
@@ -149,6 +199,13 @@ describe('License Key Groups Module Tests', function () {
expect(options).toEqual(undefined);
});
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
+ });
+
return LicenseKeyGroupsActionHelper.saveLicenseKeyGroup(store.dispatch, {
previousLicenseKeyGroup: previousLicenseKeyGroupData,
licenseKeyGroup: licenseKeyGroupUpdatedData,
@@ -182,7 +239,9 @@ describe('License Key Groups Module Tests', function () {
it('Add Limit', () => {
- const store = storeCreator();
+ const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps}
+ });
deepFreeze(store.getState());
const limitToAdd = LimitPostFactory.build();
@@ -198,7 +257,16 @@ describe('License Key Groups Module Tests', function () {
deepFreeze(limitAddedItem);
const licenseKeyGroup = LicenseKeyGroupStoreFactory.build();
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseKeyGroup.licenseKeyGroupsEditor.limitsList', [limitAddedItem]);
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
+
+ let expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseKeyGroup.licenseKeyGroupsEditor.limitsList', [limitAddedItem]);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
mockRest.addHandler('post', ({data, options, baseUrl}) => {
expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-key-groups/${licenseKeyGroup.id}/limits`);
@@ -217,6 +285,13 @@ describe('License Key Groups Module Tests', function () {
return {results: [limitAddedItem]};
});
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
+ });
+
return LicenseKeyGroupsActionHelper.submitLimit(store.dispatch,
{
licenseModelId: LICENSE_MODEL_ID,
@@ -235,6 +310,7 @@ describe('License Key Groups Module Tests', function () {
deepFreeze(limitsList);
const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps},
licenseModel: {
entitlementPool: {
entitlementPoolEditor: {
@@ -246,7 +322,17 @@ describe('License Key Groups Module Tests', function () {
deepFreeze(store.getState());
const licenseKeyGroup = LicenseKeyGroupStoreFactory.build();
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseKeyGroup.licenseKeyGroupsEditor.limitsList', []);
+
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
+
+ let expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseKeyGroup.licenseKeyGroupsEditor.limitsList', []);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
mockRest.addHandler('destroy', ({data, options, baseUrl}) => {
expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-key-groups/${licenseKeyGroup.id}/limits/${limitsList[0].id}`);
@@ -266,6 +352,13 @@ describe('License Key Groups Module Tests', function () {
return {results: []};
});
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
+ });
+
return LicenseKeyGroupsActionHelper.deleteLimit(store.dispatch, {
licenseModelId: LICENSE_MODEL_ID,
version,
@@ -282,6 +375,7 @@ describe('License Key Groups Module Tests', function () {
deepFreeze(limitsList);
const licenseKeyGroup = LicenseKeyGroupStoreFactory.build();
const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps},
licenseModel: {
licenseKeyGroup: {
licenseKeyGroupsEditor: {
@@ -304,7 +398,16 @@ describe('License Key Groups Module Tests', function () {
updatedLimit.unit = {choice: updatedLimit.unit, other: ''};
deepFreeze(updatedLimit);
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseKeyGroup.licenseKeyGroupsEditor.limitsList', [updatedLimitForPut]);
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
+
+ let expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseKeyGroup.licenseKeyGroupsEditor.limitsList', [updatedLimitForPut]);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
mockRest.addHandler('put', ({data, options, baseUrl}) => {
@@ -321,6 +424,13 @@ describe('License Key Groups Module Tests', function () {
return {results: [updatedLimitForPut]};
});
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
+ });
+
return LicenseKeyGroupsActionHelper.submitLimit(store.dispatch,
{
licenseModelId: LICENSE_MODEL_ID,
diff --git a/openecomp-ui/test/licenseModel/overview/summary/SummaryCountList.test.js b/openecomp-ui/test/licenseModel/overview/summary/SummaryCountList.test.js
index 27f7aa68fd..87e35785ca 100644
--- a/openecomp-ui/test/licenseModel/overview/summary/SummaryCountList.test.js
+++ b/openecomp-ui/test/licenseModel/overview/summary/SummaryCountList.test.js
@@ -55,7 +55,6 @@ describe('License Model Overview Summary Count List module test', () => {
];
var result = mapStateToProps(obj);
- expect(result.isReadOnlyMode).toEqual(true);
expect(result.description).toEqual(obj.licenseModel.licenseModelEditor.data.description);
expect(result.counts).toEqual(counts);
});
@@ -79,7 +78,7 @@ describe('License Model Overview Summary Count List module test', () => {
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
index 7ec85a456b..57ae2618ce 100644
--- a/openecomp-ui/test/licenseModel/overview/summary/VendorDataView.test.js
+++ b/openecomp-ui/test/licenseModel/overview/summary/VendorDataView.test.js
@@ -33,7 +33,6 @@ describe('License Model Overview Summary module test', () => {
};
var props = mapStateToProps(state);
- expect(props.isReadOnlyMode).toEqual(true);
expect(props.description).toEqual(undefined);
expect(props.data).toEqual(state.licenseModel.licenseModelEditor.data);
@@ -41,7 +40,7 @@ describe('License Model Overview Summary module test', () => {
it('jsx view test', () => {
var data = LicenseModelStoreFactory.build();
- var view = TestUtils.renderIntoDocument(<VendorDataView isReadOnlyMode={false} description='' data={data} genericFieldInfo={{description: {isValid: true}}}/>);
+ var view = TestUtils.renderIntoDocument(<VendorDataView description='' data={data} genericFieldInfo={{description: {isValid: true}}}/>);
expect(view).toBeTruthy();
});
diff --git a/openecomp-ui/test/licenseModel/overview/test.js b/openecomp-ui/test/licenseModel/overview/test.js
index cb1a9c34b2..d881985088 100644
--- a/openecomp-ui/test/licenseModel/overview/test.js
+++ b/openecomp-ui/test/licenseModel/overview/test.js
@@ -47,7 +47,6 @@ describe('License Model Overview: ', function () {
};
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);
@@ -79,7 +78,6 @@ describe('License Model Overview: ', function () {
};
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);
@@ -112,7 +110,6 @@ describe('License Model Overview: ', function () {
};
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);
@@ -121,7 +118,7 @@ describe('License Model Overview: ', function () {
});
it('should mapper return overview data for show EP modal', () => {
- const VLM1 = LicenseModelOverviewFactory.build( {
+ const VLM1 = LicenseModelOverviewFactory.build({
featureGroup: {
featureGroupsList: [],
},
@@ -141,7 +138,6 @@ describe('License Model Overview: ', function () {
};
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);
@@ -173,7 +169,6 @@ describe('License Model Overview: ', function () {
};
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);
@@ -233,7 +228,6 @@ describe('License Model Overview: ', function () {
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);
@@ -282,7 +276,6 @@ describe('License Model Overview: ', function () {
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);
@@ -310,6 +303,7 @@ describe('License Model Overview: ', function () {
selectedTab: selectedButton.NOT_IN_USE
}
});
+
const state = {
licenseModel: VLM1
};
@@ -322,7 +316,6 @@ describe('License Model Overview: ', function () {
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);
@@ -372,7 +365,6 @@ describe('License Model Overview: ', function () {
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);
@@ -380,5 +372,4 @@ describe('License Model Overview: ', function () {
expect(props.orphanDataList).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
index cee34145a8..c750f3dc02 100644
--- a/openecomp-ui/test/licenseModel/overview/views.test.js
+++ b/openecomp-ui/test/licenseModel/overview/views.test.js
@@ -39,7 +39,7 @@ describe('License Model Overview - View: ', function () {
it('should render SummaryView', () => {
var renderer = TestUtils.createRenderer();
renderer.render(
- <SummaryView />
+ <SummaryView isReadOnly={false} />
);
let renderedOutput = renderer.getRenderOutput();
expect(renderedOutput).toBeTruthy();
diff --git a/openecomp-ui/test/licenseModel/test.js b/openecomp-ui/test/licenseModel/test.js
index eac1297f3e..6cb2168cbb 100644
--- a/openecomp-ui/test/licenseModel/test.js
+++ b/openecomp-ui/test/licenseModel/test.js
@@ -16,9 +16,15 @@
import deepFreeze from 'deep-freeze';
import mockRest from 'test-utils/MockRest.js';
import {storeCreator} from 'sdc-app/AppStore.js';
+import {cloneAndSet} from 'test-utils/Util.js';
+import LicenseModelActionHelper from 'sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js';
import LicenseModelCreationActionHelper from 'sdc-app/onboarding/licenseModel/creation/LicenseModelCreationActionHelper.js';
-
-import {LicenseModelPostFactory, LicenseModelDispatchFactory} from 'test-utils/factories/licenseModel/LicenseModelFactories.js';
+import {LicenseModelPostFactory, LicenseModelDispatchFactory, LicenseModelStoreFactory} from 'test-utils/factories/licenseModel/LicenseModelFactories.js';
+import VersionFactory from 'test-utils/factories/common/VersionFactory.js';
+import {default as CurrentScreenFactory} from 'test-utils/factories/common/CurrentScreenFactory.js';
+import {actionsEnum as VersionControllerActionsEnum} from 'nfvo-components/panel/versionController/VersionControllerConstants.js';
+import {SyncStates} from 'sdc-app/common/merge/MergeEditorConstants.js';
+import {itemTypes} from 'sdc-app/onboarding/versionsPage/VersionsPageConstants.js';
describe('License Model Module Tests', function () {
it('Add License Model', () => {
@@ -46,4 +52,90 @@ describe('License Model Module Tests', function () {
expect(response.value).toEqual(licenseModelIdFromResponse);
});
});
+
+ it('Validating readonly screen after submit', () => {
+ const version = VersionFactory.build({}, {isCertified: false});
+ const itemPermissionAndProps = CurrentScreenFactory.build({}, {version});
+ const licenseModel = LicenseModelStoreFactory.build();
+ deepFreeze(licenseModel);
+
+ const store = storeCreator({
+ currentScreen: {...itemPermissionAndProps},
+ licenseModel: {
+ licenseModelEditor: {data: licenseModel},
+ }
+ });
+ deepFreeze(store.getState());
+
+ const certifiedVersion = {
+ ...itemPermissionAndProps.props.version,
+ status: 'Certified'
+ };
+
+ const expectedCurrentScreenProps = {
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isCertified: true
+ },
+ props: {
+ isReadOnlyMode: true,
+ version: certifiedVersion
+ }
+ };
+ const expectedSuccessModal = {
+ cancelButtonText: 'OK',
+ modalClassName: 'notification-modal',
+ msg: 'This license model successfully submitted',
+ timeout: 2000,
+ title: 'Submit Succeeded',
+ type: 'success'
+ };
+
+ const versionsList = {
+ itemType: itemTypes.LICENSE_MODEL,
+ itemId: licenseModel.id,
+ versions: [{...certifiedVersion}]
+ };
+
+ let expectedStore = store.getState();
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.props', expectedCurrentScreenProps.props);
+ expectedStore = cloneAndSet(expectedStore, 'modal', expectedSuccessModal);
+ expectedStore = cloneAndSet(expectedStore, 'versionsPage.versionsList', versionsList );
+
+ mockRest.addHandler('put', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${licenseModel.id}/versions/${version.id}/actions`);
+ expect(data).toEqual({action: VersionControllerActionsEnum.SUBMIT});
+ expect(options).toEqual(undefined);
+ return {returnCode: 'OK'};
+ });
+
+ mockRest.addHandler('put', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${licenseModel.id}/versions/${version.id}/actions`);
+ expect(data).toEqual({action: VersionControllerActionsEnum.CREATE_PACKAGE});
+ expect(options).toEqual(undefined);
+ return {returnCode: 'OK'};
+ });
+
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${licenseModel.id}/versions/${version.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {...certifiedVersion, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: false}};
+ });
+
+ mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${licenseModel.id}/versions`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {results: [{...certifiedVersion}]};
+ });
+
+ return LicenseModelActionHelper.performSubmitAction(store.dispatch, {
+ licenseModelId: licenseModel.id,
+ version
+ }).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
+ });
+ });
});