ui support for archive items
Issue-ID: SDC-1088
Change-Id: I836e4896a8ec6bb065f9d2571f514916ccf6759f
Signed-off-by: svishnev <shlomo-stanisla.vishnevetskiy@amdocs.com>
diff --git a/openecomp-ui/test/licenseModel/creation/LicenseModelCreation.test.js b/openecomp-ui/test/licenseModel/creation/LicenseModelCreation.test.js
index a52d06b..59ac267 100644
--- a/openecomp-ui/test/licenseModel/creation/LicenseModelCreation.test.js
+++ b/openecomp-ui/test/licenseModel/creation/LicenseModelCreation.test.js
@@ -28,6 +28,8 @@
it ('should return empty data', () => {
let state = {
licenseModelList: [],
+ archivedLicenseModelList: [],
+ finalizedLicenseModelList: [],
licenseModel: {
licenseModelCreation: {
data: {}
@@ -43,6 +45,8 @@
it ('should return vlm names list', () => {
let state = {
+ archivedLicenseModelList: [],
+ finalizedLicenseModelList: [],
licenseModelList: [{
name: 'vlm1',
id: 'vlm1_id'
diff --git a/openecomp-ui/test/licenseModel/entitlementPools/test.js b/openecomp-ui/test/licenseModel/entitlementPools/test.js
index 173384d..dc56b11 100644
--- a/openecomp-ui/test/licenseModel/entitlementPools/test.js
+++ b/openecomp-ui/test/licenseModel/entitlementPools/test.js
@@ -88,14 +88,14 @@
}
};
});
-
+
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,
@@ -148,6 +148,8 @@
return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}};
});
+
+
return EntitlementPoolsActionHelper.saveEntitlementPool(store.dispatch,
{
licenseModelId: LICENSE_MODEL_ID,
diff --git a/openecomp-ui/test/nfvo-components/panel/VersionController/versionController.test.js b/openecomp-ui/test/nfvo-components/panel/VersionController/versionController.test.js
index 3b4f0de..ae24dbf 100644
--- a/openecomp-ui/test/nfvo-components/panel/VersionController/versionController.test.js
+++ b/openecomp-ui/test/nfvo-components/panel/VersionController/versionController.test.js
@@ -135,4 +135,11 @@
expect(elem.length).toBe(1);
});
+ it ('Do not show action buttons in case of archived item', () =>{
+ let propsForArchivedItem = {...props, isArchived: true};
+ let versionController = TestUtils.renderIntoDocument(<Provider store={store}><VersionController {...propsForArchivedItem} /></Provider>);
+ let saveBtn = TestUtils.scryRenderedDOMComponentsWithClass(versionController,'collaborator-action-buttons');
+ expect(saveBtn).toBeTruthy();
+ expect(saveBtn.length).toBe(0);
+ });
});
diff --git a/openecomp-ui/test/onboard/onboardingCatalog/test.js b/openecomp-ui/test/onboard/onboardingCatalog/test.js
index cc54e31..4e38675 100644
--- a/openecomp-ui/test/onboard/onboardingCatalog/test.js
+++ b/openecomp-ui/test/onboard/onboardingCatalog/test.js
@@ -1,17 +1,17 @@
-/*!
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+/*
+ * Copyright © 2016-2018 European Support Limited
*
* 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
- *
+ *
+ * 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.
+ * 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 {storeCreator} from 'sdc-app/AppStore.js';
import {OnboardingCatalogStoreFactory} from 'test-utils/factories/onboard/OnboardingCatalogFactories.js';
@@ -29,8 +29,8 @@
it('should change active tab to All', () => {
const store = storeCreator();
- const expectedStore = OnboardingCatalogStoreFactory.build({activeTab: tabsMapping.ALL});
- OnboardingCatalogActionHelper.changeActiveTab(store.dispatch, tabsMapping.ALL);
+ const expectedStore = OnboardingCatalogStoreFactory.build({activeTab: tabsMapping.ACTIVE});
+ OnboardingCatalogActionHelper.changeActiveTab(store.dispatch, tabsMapping.ACTIVE);
expect(store.getState().onboard.onboardingCatalog).toEqual(expectedStore);
});
diff --git a/openecomp-ui/test/onboard/onboardingCatalog/views.test.js b/openecomp-ui/test/onboard/onboardingCatalog/views.test.js
index 289826a..63b49aa 100644
--- a/openecomp-ui/test/onboard/onboardingCatalog/views.test.js
+++ b/openecomp-ui/test/onboard/onboardingCatalog/views.test.js
@@ -15,6 +15,9 @@
*/
import React from 'react';
+import {Provider} from 'react-redux';
+import {storeCreator} from 'sdc-app/AppStore.js';
+
import TestUtils from 'react-dom/test-utils';
import {defaultStoreFactory} from 'test-utils/factories/onboard/OnboardingCatalogFactories.js';
import {FinalizedLicenseModelFactory} from 'test-utils/factories/licenseModel/LicenseModelFactories.js';
@@ -80,8 +83,13 @@
};
let params = {...func, ...mapStateToProps(data)};
- let CatalogView = TestUtils.renderIntoDocument(<OnboardingCatalogView
- {...params}/>);
+ const store = storeCreator();
+
+ let CatalogView = TestUtils.renderIntoDocument(
+ <Provider store={store}>
+ <OnboardingCatalogView
+ {...params}/>
+ </Provider>);
expect(CatalogView).toBeTruthy();
});
diff --git a/openecomp-ui/test/onboard/test.js b/openecomp-ui/test/onboard/test.js
index 18bb042..232c561 100644
--- a/openecomp-ui/test/onboard/test.js
+++ b/openecomp-ui/test/onboard/test.js
@@ -1,17 +1,17 @@
-/*!
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+/*
+ * Copyright © 2016-2018 European Support Limited
*
* 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
- *
+ *
+ * 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.
+ * 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 {storeCreator} from 'sdc-app/AppStore.js';
import {OnboardStoreFactory} from 'test-utils/factories/onboard/OnboardFactories.js';
@@ -54,7 +54,7 @@
const expectedStore = OnboardStoreFactory.build();
OnboardActionHelper.changeSearchValue(store.dispatch, 'hello');
OnboardActionHelper.changeActiveTab(store.dispatch, onboardTabsMapping.CATALOG);
- OnboardingCatalogActionHelper.changeActiveTab(store.dispatch, onboardCatalogTabsMapping.ALL);
+ OnboardingCatalogActionHelper.changeActiveTab(store.dispatch, onboardCatalogTabsMapping.ACTIVE);
OnboardActionHelper.resetOnboardStore(store.dispatch, 'hello');
expect(store.getState().onboard).toEqual(expectedStore);
});
diff --git a/openecomp-ui/test/softwareProduct/creation/SoftwareProductCreation.test.js b/openecomp-ui/test/softwareProduct/creation/SoftwareProductCreation.test.js
index 51db931..20ca17d 100644
--- a/openecomp-ui/test/softwareProduct/creation/SoftwareProductCreation.test.js
+++ b/openecomp-ui/test/softwareProduct/creation/SoftwareProductCreation.test.js
@@ -31,6 +31,8 @@
it ('should return empty data', () => {
let state = {
softwareProductList: [],
+ finalizedSoftwareProductList: [],
+ archivedSoftwareProductList: [],
softwareProduct: {
softwareProductCreation: {
data: {}
@@ -46,6 +48,8 @@
it ('should return vsp names list', () => {
let state = {
+ finalizedSoftwareProductList: [],
+ archivedSoftwareProductList: [],
softwareProductList: [{
name: 'vsp1',
id: 'vsp1_id'
@@ -73,6 +77,8 @@
let state = {
softwareProductList: [],
+ finalizedSoftwareProductList: [],
+ archivedSoftwareProductList: [],
softwareProduct: {
softwareProductCreation: SoftwareProductCreationFactory.build(),
softwareProductCategories: CategoryWithSubFactory.buildList({}, {quantity: 2})
@@ -97,6 +103,8 @@
let finalizedLicenseModelList = FinalizedLicenseModelFactory.buildList(3);
let state = {
softwareProductList: [],
+ finalizedSoftwareProductList: [],
+ archivedSoftwareProductList: [],
softwareProduct: {
softwareProductCreation: SoftwareProductCreationFactoryWithSelectedVendor.build({selectedVendorId: finalizedLicenseModelList[0].id}),
softwareProductCategories: CategoryWithSubFactory.buildList({}, {quantity: 2})
diff --git a/openecomp-ui/test/softwareProduct/details/detailsView.test.js b/openecomp-ui/test/softwareProduct/details/detailsView.test.js
index 33cc36e..46983f5 100644
--- a/openecomp-ui/test/softwareProduct/details/detailsView.test.js
+++ b/openecomp-ui/test/softwareProduct/details/detailsView.test.js
@@ -1,7 +1,7 @@
/*
* Copyright © 2016-2018 European Support Limited
*
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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
*
@@ -25,7 +25,6 @@
import {SchemaGenericFieldInfoFactory} from 'test-utils/factories/softwareProduct/SoftwareProductQSchemaFactory.js';
import {default as VspQdataFactory, VspDataMapFactory} from 'test-utils/factories/softwareProduct/VspQdataFactory.js';
import {FinalizedLicenseModelFactory} from 'test-utils/factories/licenseModel/LicenseModelFactories.js';
-import VersionFactory from 'test-utils/factories/common/VersionFactory.js';
import CurrentScreenFactory from 'test-utils/factories/common/CurrentScreenFactory.js';
describe('Software Product Details: ', function () {
@@ -46,9 +45,14 @@
licenseAgreementList = LicenseAgreementStoreFactory.buildList(2);
licensingVersionsList = [
{
- "id":"0127b419e9574a11aab8e031a78fc534",
- "name":"1.0","description":"Initial version",
- "baseId":"","status":"Certified","creationTime":1506409288390,"modificationTime":1506409288390,"additionalInfo":{"OptionalCreationMethods":["minor"]}},{"id":"ea159ffedd9a4f9a8a56d53ba66b7314","name":"2.0","description":"ggggg","baseId":"0127b419e9574a11aab8e031a78fc534","status":"Draft","creationTime":1508839019802,"modificationTime":1508839019802,"additionalInfo":{"OptionalCreationMethods":[]}}
+ 'id':'0127b419e9574a11aab8e031a78fc534',
+ 'name':'1.0','description':'Initial version',
+ 'baseId':'','status':'Certified','creationTime':1506409288390,
+ 'modificationTime':1506409288390,'additionalInfo':{'OptionalCreationMethods':['minor']}},
+ {'id':'ea159ffedd9a4f9a8a56d53ba66b7314','name':'2.0','description':'ggggg',
+ 'baseId':'0127b419e9574a11aab8e031a78fc534','status':'Draft','creationTime':1508839019802,
+ 'modificationTime':1508839019802,'additionalInfo':{'OptionalCreationMethods':[]}
+ }
];
featureGroupsList = FeatureGroupStoreFactory.buildList(2, {referencingLicenseAgreements: [licenseAgreementList[0].id]});
qdata = VspQdataFactory.build();
@@ -109,7 +113,9 @@
featureGroup: {
featureGroupsList: []
}
- }
+ },
+ archivedLicenseModelList: [],
+ archivedSoftwareProductList: []
};
var result = mapStateToProps(obj);
@@ -145,7 +151,9 @@
dataMap
}
},
- finalizedLicenseModelList: finalizedLicenseModelList,
+ finalizedLicenseModelList: finalizedLicenseModelList,
+ archivedLicenseModelList: [],
+ archivedSoftwareProductList: [],
licenseModel: {
licenseAgreement: {
licenseAgreementList: licenseAgreementList
diff --git a/openecomp-ui/test/softwareProduct/details/test.js b/openecomp-ui/test/softwareProduct/details/test.js
index 27cbaa4..6050624 100644
--- a/openecomp-ui/test/softwareProduct/details/test.js
+++ b/openecomp-ui/test/softwareProduct/details/test.js
@@ -1,17 +1,17 @@
-/*!
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+/*
+ * Copyright © 2016-2018 European Support Limited
*
* 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
+ * 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.
+ * 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 deepFreeze from 'deep-freeze';
import mockRest from 'test-utils/MockRest.js';
@@ -35,7 +35,7 @@
import {InitializedCurrentScreenFactory} from 'test-utils/factories/common/CurrentScreenFactory.js';
describe('Software Product Details Module Tests', function () {
- it('Get Software Products List', () => {
+ it('Get Software Products List', async () => {
const store = storeCreator();
deepFreeze(store.getState());
const softwareProductList = VSPEditorFactory.buildList(2);
@@ -57,11 +57,18 @@
return {results: []};
});
- return SoftwareProductActionHelper.fetchSoftwareProductList(store.dispatch).then(() => {
- return SoftwareProductActionHelper.fetchFinalizedSoftwareProductList(store.dispatch);
- }).then(() => {
- expect(store.getState()).toEqual(expectedStore);
+ mockRest.addHandler('fetch', ({options, data, baseUrl}) => {
+ expect(baseUrl).toEqual('/onboarding-api/v1.0/vendor-software-products/?Status=ARCHIVED');
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {results: []};
});
+
+ await SoftwareProductActionHelper.fetchSoftwareProductList(store.dispatch);
+ await SoftwareProductActionHelper.fetchFinalizedSoftwareProductList(store.dispatch);
+ await SoftwareProductActionHelper.fetchArchivedSoftwareProductList(store.dispatch);
+
+ expect(store.getState()).toEqual(expectedStore);
});
it('Add Software Product', () => {
diff --git a/openecomp-ui/test/versionsPage/VersionsPage.test.js b/openecomp-ui/test/versionsPage/VersionsPage.test.js
index 61e93cb..fd7659e 100644
--- a/openecomp-ui/test/versionsPage/VersionsPage.test.js
+++ b/openecomp-ui/test/versionsPage/VersionsPage.test.js
@@ -16,11 +16,12 @@
import React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow';
+import {mount} from 'enzyme';
+import {Provider} from 'react-redux';
import deepFreeze from 'deep-freeze';
import mockRest from 'test-utils/MockRest.js';
import Configuration from 'sdc-app/config/Configuration.js';
import {storeCreator} from 'sdc-app/AppStore.js';
-
import {mapStateToProps, mapActionsToProps} from 'sdc-app/onboarding/versionsPage/VersionsPage.js';
import VersionsPageView from 'sdc-app/onboarding/versionsPage/VersionsPage.jsx';
import VersionsPageActionHelper from 'sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js';
@@ -29,6 +30,7 @@
import VersionFactory from 'test-utils/factories/common/VersionFactory.js';
import {VersionsPageCreationFactory} from 'test-utils/factories/versionsPage/VersionsPageCreationFactories.js';
import {VersionsPageAdditionalPropsFactory} from 'test-utils/factories/versionsPage/VersionsPageFactories.js';
+import {cloneAndSet} from 'test-utils/Util.js';
describe('Versions Page Module Tests', () => {
@@ -45,7 +47,15 @@
userInfo: 'user123'
},
versionsPage: {
- permissions: {},
+ permissions: {
+ contributors: [],
+ owner: {
+ userId: 'fgfgfg',
+ permission: 'Owner',
+ fullName: 'Test User',
+ role: 'Test ROLE'
+ }
+ },
versionsList: {versions: []},
versionCreation: {}
}
@@ -71,7 +81,7 @@
const additionalProps = VersionsPageAdditionalPropsFactory.build();
- const props = Object.assign({}, mapStateToProps(state), mapActionsToProps(dispatch, additionalProps));
+ const props = {...mapStateToProps(state), ...mapActionsToProps(dispatch, additionalProps)};
const renderer = new ShallowRenderer();
renderer.render(<VersionsPageView {...props} />);
@@ -79,6 +89,23 @@
expect(renderedOutput).toBeTruthy();
});
+ /**
+ * turn on when ARCHIVE_ITEM feature toggle will be removed in VersionPage.jsx
+ */
+ // it('archive btn test', () => {
+
+ // const store = storeCreator();
+ // const dispatch = store.dispatch;
+
+ // const additionalProps = VersionsPageAdditionalPropsFactory.build();
+ // const props = {...mapStateToProps(state), ...mapActionsToProps(dispatch, additionalProps)};
+ // const wrapper = mount(<Provider store={store}><VersionsPageView {...props}/></Provider>);
+ // const depricateBtn = wrapper.find('.depricate-btn');
+ // expect(depricateBtn).toBeTruthy();
+ // expect(depricateBtn.text()).toBe('ARCHIVE');
+ // });
+
+
});