summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/test/licenseModel/entitlementPools
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-08-10 18:21:36 +0000
committerGerrit Code Review <gerrit@onap.org>2017-08-10 18:21:36 +0000
commitce07d7cd59425944f85d0fef5126ebeef731bc7b (patch)
treea0d8bb991aa164e01eb930b23f34d9e27999602a /openecomp-ui/test/licenseModel/entitlementPools
parent46f9fd57f24428f6a6fd0d290b0463e188975231 (diff)
parent644017cb3edd5b7a077a634ffd5daf2fee6bc088 (diff)
Merge "[SDC] OnBoard with enabled tests and features"
Diffstat (limited to 'openecomp-ui/test/licenseModel/entitlementPools')
-rw-r--r--openecomp-ui/test/licenseModel/entitlementPools/test.js35
1 files changed, 22 insertions, 13 deletions
diff --git a/openecomp-ui/test/licenseModel/entitlementPools/test.js b/openecomp-ui/test/licenseModel/entitlementPools/test.js
index 911fb011f4..f5415239ad 100644
--- a/openecomp-ui/test/licenseModel/entitlementPools/test.js
+++ b/openecomp-ui/test/licenseModel/entitlementPools/test.js
@@ -21,6 +21,7 @@ import EntitlementPoolsActionHelper from 'sdc-app/onboarding/licenseModel/entitl
import {EntitlementPoolStoreFactory, EntitlementPoolPostFactory} from 'test-utils/factories/licenseModel/EntitlementPoolFactories.js';
import VersionControllerUtilsFactory from 'test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js';
import {LimitItemFactory, LimitPostFactory} from 'test-utils/factories/licenseModel/LimitFactories.js';
+import {getStrValue} from 'nfvo-utils/getValue.js';
describe('Entitlement Pools Module Tests', function () {
@@ -165,7 +166,7 @@ describe('Entitlement Pools Module Tests', function () {
it('Load Limits List', () => {
- const limitsList = LimitItemFactory.buildList(3);
+ const limitsList = LimitItemFactory.buildList(3);
deepFreeze(limitsList);
const store = storeCreator();
deepFreeze(store.getState());
@@ -190,8 +191,12 @@ describe('Entitlement Pools Module Tests', function () {
deepFreeze(store.getState());
const limitToAdd = LimitPostFactory.build();
+ let limitFromBE = {...limitToAdd};
+ limitFromBE.metric = getStrValue(limitFromBE.metric);
+ limitFromBE.unit = getStrValue(limitFromBE.unit);
deepFreeze(limitToAdd);
+ deepFreeze(limitFromBE);
const LimitIdFromResponse = 'ADDED_ID';
const limitAddedItem = {...limitToAdd, id: LimitIdFromResponse};
@@ -202,7 +207,7 @@ describe('Entitlement Pools Module Tests', function () {
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`);
- expect(data).toEqual(limitToAdd);
+ expect(data).toEqual(limitFromBE);
expect(options).toEqual(undefined);
return {
returnCode: 'OK',
@@ -220,7 +225,7 @@ describe('Entitlement Pools Module Tests', function () {
return EntitlementPoolsActionHelper.submitLimit(store.dispatch,
{
licenseModelId: LICENSE_MODEL_ID,
- version,
+ version,
entitlementPool,
limit: limitToAdd
}
@@ -232,9 +237,9 @@ describe('Entitlement Pools Module Tests', function () {
it('Delete Limit', () => {
- const limitsList = LimitItemFactory.buildList(1);
+ const limitsList = LimitItemFactory.buildList(1);
deepFreeze(limitsList);
-
+
const store = storeCreator({
licenseModel: {
entitlementPool: {
@@ -279,7 +284,7 @@ describe('Entitlement Pools Module Tests', function () {
it('Update Limit', () => {
- const limitsList = LimitItemFactory.buildList(1);
+ const limitsList = LimitItemFactory.buildList(1);
deepFreeze(limitsList);
const entitlementPool = EntitlementPoolStoreFactory.build();
const store = storeCreator({
@@ -294,16 +299,20 @@ describe('Entitlement Pools Module Tests', function () {
deepFreeze(store.getState());
-
+
const previousData = limitsList[0];
+
deepFreeze(previousData);
const limitId = limitsList[0].id;
-
- const updatedLimit = {...previousData, name: 'updatedLimit'};
- deepFreeze(updatedLimit);
+
+ let updatedLimit = {...previousData, name: 'updatedLimit'};
+
const updatedLimitForPut = {...updatedLimit, id: undefined};
+ updatedLimit.metric = {choice: updatedLimit.metric, other: ''};
+ updatedLimit.unit = {choice: updatedLimit.unit, other: ''};
+ deepFreeze(updatedLimit);
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolEditor.limitsList', [updatedLimit]);
+ const expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolEditor.limitsList', [updatedLimitForPut]);
mockRest.addHandler('put', ({data, options, baseUrl}) => {
@@ -317,13 +326,13 @@ describe('Entitlement Pools Module Tests', function () {
expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/entitlement-pools/${entitlementPool.id}/limits`);
expect(data).toEqual(undefined);
expect(options).toEqual(undefined);
- return {results: [updatedLimit]};
+ return {results: [updatedLimitForPut]};
});
return EntitlementPoolsActionHelper.submitLimit(store.dispatch,
{
licenseModelId: LICENSE_MODEL_ID,
- version,
+ version,
entitlementPool,
limit: updatedLimit
}