From cb1d48383b166c9b3fa8f9034b28fb3e662c1d80 Mon Sep 17 00:00:00 2001 From: ilanap Date: Wed, 27 Sep 2017 11:41:19 +0300 Subject: Fix orphan list for VLMs Fix the orphan list where feature groups stayed orphans after a license agreement that contains them was created. Issue-ID: SDC-407 Change-Id: I80b20e46fb4077ba0632e897437cfd795f134ad1 Signed-off-by: ilanap --- .../test/licenseModel/licenseAgreement/test.js | 28 ++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'openecomp-ui/test') diff --git a/openecomp-ui/test/licenseModel/licenseAgreement/test.js b/openecomp-ui/test/licenseModel/licenseAgreement/test.js index 442f7bf91f..40b60da77f 100644 --- a/openecomp-ui/test/licenseModel/licenseAgreement/test.js +++ b/openecomp-ui/test/licenseModel/licenseAgreement/test.js @@ -93,7 +93,9 @@ describe('License Agreement Module Tests', () => { id: licenseAgreementIdFromResponse }); deepFreeze(licenseAgreementAfterAdd); + const licenseAgreementList = [licenseAgreementAfterAdd]; + const featureGroupsList = licenseAgreementList.featureGroupsIds; const expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseAgreement.licenseAgreementList', [licenseAgreementAfterAdd]); mockRest.addHandler('post', ({options, data, baseUrl}) => { @@ -104,7 +106,18 @@ describe('License Agreement Module Tests', () => { value: licenseAgreementIdFromResponse }; }); - + mockRest.addHandler('fetch', ({options, data, baseUrl}) => { + expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-agreements`); + expect(data).toEqual(undefined); + expect(options).toEqual(undefined); + return {results: licenseAgreementList}; + }); + 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: featureGroupsList}; + }); return LicenseAgreementActionHelper.saveLicenseAgreement(store.dispatch, { licenseAgreement: licenseAgreementToAdd, licenseModelId: LICENSE_MODEL_ID, @@ -151,7 +164,18 @@ describe('License Agreement Module Tests', () => { expect(data).toEqual(LicenseAgreementPutFactoryRequest); expect(options).toEqual(undefined); }); - + mockRest.addHandler('fetch', ({options, data, baseUrl}) => { + expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-agreements`); + expect(data).toEqual(undefined); + expect(options).toEqual(undefined); + return {results: [licenseAgreementUpdateData]}; + }); + 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, -- cgit 1.2.3-korg