attachment page navigation fix
Issue-ID: SDC-1239
Change-Id: Ib597238233e9a035944b7a56a56601cdfd624ca2
Signed-off-by: svishnev <shlomo-stanisla.vishnevetskiy@amdocs.com>
diff --git a/openecomp-ui/test/licenseModel/featureGroups/test.js b/openecomp-ui/test/licenseModel/featureGroups/test.js
index eb947b8..63c876c 100644
--- a/openecomp-ui/test/licenseModel/featureGroups/test.js
+++ b/openecomp-ui/test/licenseModel/featureGroups/test.js
@@ -1,306 +1,456 @@
-/*!
- * 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';
-import {cloneAndSet, buildListFromFactory} from 'test-utils/Util.js';
-import {storeCreator} from 'sdc-app/AppStore.js';
+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 {
+ FeatureGroupStoreFactory,
+ FeatureGroupPostFactory,
+ FeatureGroupDispatchFactory,
+ FeatureGroupPutFactory
+} from 'test-utils/factories/licenseModel/FeatureGroupFactories.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';
+import { SyncStates } from 'sdc-app/common/merge/MergeEditorConstants.js';
+describe('Feature Groups Module Tests', function() {
+ const LICENSE_MODEL_ID = '555';
+ 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
+ };
-describe('Feature Groups Module Tests', function () {
+ it('Load Feature Groups List', () => {
+ const featureGroupsList = buildListFromFactory(
+ FeatureGroupStoreFactory
+ );
+ deepFreeze(featureGroupsList);
- const LICENSE_MODEL_ID = '555';
- 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};
+ const store = storeCreator();
+ deepFreeze(store.getState());
- it('Load Feature Groups List', () => {
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'licenseModel.featureGroup.featureGroupsList',
+ featureGroupsList
+ );
- const featureGroupsList = buildListFromFactory(FeatureGroupStoreFactory);
- deepFreeze(featureGroupsList);
+ mockRest.addHandler('fetch', ({ data, options, 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 };
+ });
- const store = storeCreator();
- deepFreeze(store.getState());
+ return FeatureGroupsActionHelper.fetchFeatureGroupsList(
+ store.dispatch,
+ { licenseModelId: LICENSE_MODEL_ID, version }
+ ).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
+ });
+ });
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.featureGroup.featureGroupsList', featureGroupsList);
+ it('Delete Feature Group', () => {
+ const featureGroupsList = buildListFromFactory(
+ FeatureGroupStoreFactory,
+ 1
+ );
+ deepFreeze(featureGroupsList);
+ const store = storeCreator({
+ currentScreen: { ...itemPermissionAndProps },
+ licenseModel: {
+ featureGroup: {
+ featureGroupsList
+ }
+ }
+ });
+ deepFreeze(store.getState());
- mockRest.addHandler('fetch', ({data, options, 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};
- });
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
- return FeatureGroupsActionHelper.fetchFeatureGroupsList(store.dispatch, {licenseModelId: LICENSE_MODEL_ID, version}).then(() => {
- expect(store.getState()).toEqual(expectedStore);
- });
- });
+ let expectedStore = cloneAndSet(
+ store.getState(),
+ 'licenseModel.featureGroup.featureGroupsList',
+ []
+ );
+ expectedStore = cloneAndSet(
+ expectedStore,
+ 'currentScreen.itemPermission',
+ expectedCurrentScreenProps.itemPermission
+ );
- it('Delete Feature Group', () => {
- const featureGroupsList = buildListFromFactory(FeatureGroupStoreFactory, 1);
- deepFreeze(featureGroupsList);
- const store = storeCreator({
- currentScreen: {...itemPermissionAndProps},
- licenseModel: {
- featureGroup: {
- featureGroupsList
- }
- }
- });
- deepFreeze(store.getState());
+ const idToDelete = featureGroupsList[0].id;
- const expectedCurrentScreenProps = {
- ...itemPermissionAndProps,
- itemPermission: {
- ...itemPermissionAndProps.itemPermission,
- isDirty: true
- }
- };
+ mockRest.addHandler('destroy', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${
+ version.id
+ }/feature-groups/${idToDelete}`
+ );
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {
+ results: {
+ returnCode: 'OK'
+ }
+ };
+ });
- let expectedStore = cloneAndSet(store.getState(), 'licenseModel.featureGroup.featureGroupsList', []);
- expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
+ 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
+ }
+ };
+ });
- const idToDelete = featureGroupsList[0].id;
+ mockRest.addHandler('fetch', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}`
+ );
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {
+ ...returnedVersionFields
+ };
+ });
- mockRest.addHandler('destroy', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/feature-groups/${idToDelete}`);
- expect(data).toEqual(undefined);
- expect(options).toEqual(undefined);
- return {
- results: {
- returnCode: 'OK'
- }
- };
- });
+ return FeatureGroupsActionHelper.deleteFeatureGroup(store.dispatch, {
+ licenseModelId: LICENSE_MODEL_ID,
+ version,
+ featureGroupId: idToDelete
+ }).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
+ });
+ });
- 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}};
- });
+ it('Add Feature Group', () => {
+ const store = storeCreator({
+ currentScreen: { ...itemPermissionAndProps },
+ licenseModel: {
+ featureGroup: {
+ featureGroupsList: []
+ }
+ }
+ });
+ deepFreeze(store.getState());
- return FeatureGroupsActionHelper.deleteFeatureGroup(store.dispatch, {
- licenseModelId: LICENSE_MODEL_ID,
- version,
- featureGroupId: idToDelete
- }).then(() => {
- expect(store.getState()).toEqual(expectedStore);
- });
- });
+ const FeatureGroupPostRequest = FeatureGroupPostFactory.build({
+ addedLicenseKeyGroupsIds: [1],
+ addedEntitlementPoolsIds: [1]
+ });
+ const featureGroupToAdd = FeatureGroupDispatchFactory.build({
+ licenseKeyGroupsIds: [1],
+ entitlementPoolsIds: [1]
+ });
- it('Add Feature Group', () => {
+ const featureGroupIdFromResponse = 'ADDED_ID';
+ const featureGroupAfterAdd = FeatureGroupStoreFactory.build({
+ ...featureGroupToAdd,
+ id: featureGroupIdFromResponse
+ });
- const store = storeCreator({
- currentScreen: {...itemPermissionAndProps},
- licenseModel: {
- featureGroup: {
- featureGroupsList: []
- }
- }
- });
- deepFreeze(store.getState());
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
- const FeatureGroupPostRequest = FeatureGroupPostFactory.build({
- addedLicenseKeyGroupsIds: [1],
- addedEntitlementPoolsIds: [1]
- });
- const featureGroupToAdd = FeatureGroupDispatchFactory.build({
- licenseKeyGroupsIds: [1],
- entitlementPoolsIds: [1]
- });
+ let expectedStore = cloneAndSet(
+ store.getState(),
+ 'licenseModel.featureGroup.featureGroupsList',
+ [featureGroupAfterAdd]
+ );
+ expectedStore = cloneAndSet(
+ expectedStore,
+ 'currentScreen.itemPermission',
+ expectedCurrentScreenProps.itemPermission
+ );
- const featureGroupIdFromResponse = 'ADDED_ID';
- const featureGroupAfterAdd = FeatureGroupStoreFactory.build({
- ...featureGroupToAdd,
- id: featureGroupIdFromResponse
- });
+ mockRest.addHandler('post', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${
+ version.id
+ }/feature-groups`
+ );
+ expect(data).toEqual(FeatureGroupPostRequest);
+ expect(options).toEqual(undefined);
+ return {
+ returnCode: 'OK',
+ value: featureGroupIdFromResponse
+ };
+ });
- const expectedCurrentScreenProps = {
- ...itemPermissionAndProps,
- itemPermission: {
- ...itemPermissionAndProps.itemPermission,
- isDirty: true
- }
- };
+ mockRest.addHandler('fetch', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${
+ version.id
+ }/entitlement-pools`
+ );
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return { results: [] };
+ });
- let expectedStore = cloneAndSet(store.getState(), 'licenseModel.featureGroup.featureGroupsList', [featureGroupAfterAdd]);
- expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
+ mockRest.addHandler('fetch', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${
+ version.id
+ }/license-key-groups`
+ );
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return { results: [] };
+ });
- mockRest.addHandler('post', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/feature-groups`);
- expect(data).toEqual(FeatureGroupPostRequest);
- expect(options).toEqual(undefined);
- return {
- returnCode: 'OK',
- value: featureGroupIdFromResponse
- };
- });
+ 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', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/entitlement-pools`);
- expect(data).toEqual(undefined);
- expect(options).toEqual(undefined);
- return {results: []};
- });
+ mockRest.addHandler('fetch', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}`
+ );
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {
+ ...returnedVersionFields
+ };
+ });
- mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-key-groups`);
- expect(data).toEqual(undefined);
- expect(options).toEqual(undefined);
- return {results: []};
- });
+ return FeatureGroupsActionHelper.saveFeatureGroup(store.dispatch, {
+ licenseModelId: LICENSE_MODEL_ID,
+ version,
+ featureGroup: featureGroupToAdd
+ }).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
+ });
+ });
- 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}};
- });
+ it('Update Feature Group', () => {
+ const featureGroupsList = buildListFromFactory(
+ FeatureGroupStoreFactory,
+ 1,
+ {
+ licenseKeyGroupsIds: [1],
+ entitlementPoolsIds: [1]
+ }
+ );
+ deepFreeze(featureGroupsList);
+ const store = storeCreator({
+ currentScreen: { ...itemPermissionAndProps },
+ licenseModel: {
+ featureGroup: {
+ featureGroupsList
+ }
+ }
+ });
+ deepFreeze(store.getState());
- return FeatureGroupsActionHelper.saveFeatureGroup(store.dispatch, {
- licenseModelId: LICENSE_MODEL_ID,
- version,
- featureGroup: featureGroupToAdd
- }).then(() => {
- expect(store.getState()).toEqual(expectedStore);
- });
- });
+ const toBeUpdatedFeatureGroupId = featureGroupsList[0].id;
+ const previousFeatureGroupData = featureGroupsList[0];
- it('Update Feature Group', () => {
- const featureGroupsList = buildListFromFactory(FeatureGroupStoreFactory, 1, {
- licenseKeyGroupsIds: [1],
- entitlementPoolsIds: [1]
- });
- deepFreeze(featureGroupsList);
+ const featureGroupUpdateData = FeatureGroupStoreFactory.build({
+ ...previousFeatureGroupData,
+ licenseKeyGroupsIds: [7],
+ entitlementPoolsIds: [7]
+ });
+ deepFreeze(featureGroupUpdateData);
- const store = storeCreator({
- currentScreen: {...itemPermissionAndProps},
- licenseModel: {
- featureGroup: {
- featureGroupsList
- }
- }
- });
- deepFreeze(store.getState());
+ const FeatureGroupPutFactoryRequest = FeatureGroupPutFactory.build({
+ name: featureGroupUpdateData.name,
+ description: featureGroupUpdateData.description,
+ partNumber: featureGroupUpdateData.partNumber,
+ addedLicenseKeyGroupsIds: [7],
+ addedEntitlementPoolsIds: [7],
+ removedLicenseKeyGroupsIds: [1],
+ removedEntitlementPoolsIds: [1]
+ });
+ deepFreeze(FeatureGroupPutFactoryRequest);
- const toBeUpdatedFeatureGroupId = featureGroupsList[0].id;
- const previousFeatureGroupData = featureGroupsList[0];
+ const expectedCurrentScreenProps = {
+ ...itemPermissionAndProps,
+ itemPermission: {
+ ...itemPermissionAndProps.itemPermission,
+ isDirty: true
+ }
+ };
- const featureGroupUpdateData = FeatureGroupStoreFactory.build({
- ...previousFeatureGroupData,
- licenseKeyGroupsIds: [7],
- entitlementPoolsIds: [7]
- });
- deepFreeze(featureGroupUpdateData);
+ let expectedStore = cloneAndSet(
+ store.getState(),
+ 'licenseModel.featureGroup.featureGroupsList',
+ [featureGroupUpdateData]
+ );
+ expectedStore = cloneAndSet(
+ expectedStore,
+ 'currentScreen.itemPermission',
+ expectedCurrentScreenProps.itemPermission
+ );
- const FeatureGroupPutFactoryRequest = FeatureGroupPutFactory.build({
- name: featureGroupUpdateData.name,
- description: featureGroupUpdateData.description,
- partNumber: featureGroupUpdateData.partNumber,
- addedLicenseKeyGroupsIds: [7],
- addedEntitlementPoolsIds: [7],
- removedLicenseKeyGroupsIds: [1],
- removedEntitlementPoolsIds: [1]
- });
- deepFreeze(FeatureGroupPutFactoryRequest);
+ mockRest.addHandler('put', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${
+ version.id
+ }/feature-groups/${toBeUpdatedFeatureGroupId}`
+ );
+ expect(data).toEqual(FeatureGroupPutFactoryRequest);
+ expect(options).toEqual(undefined);
+ return { returnCode: 'OK' };
+ });
- const expectedCurrentScreenProps = {
- ...itemPermissionAndProps,
- itemPermission: {
- ...itemPermissionAndProps.itemPermission,
- isDirty: true
- }
- };
+ mockRest.addHandler('fetch', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${
+ version.id
+ }/entitlement-pools`
+ );
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return { results: [] };
+ });
- let expectedStore = cloneAndSet(store.getState(), 'licenseModel.featureGroup.featureGroupsList', [featureGroupUpdateData]);
- expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreenProps.itemPermission);
+ mockRest.addHandler('fetch', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${
+ version.id
+ }/license-key-groups`
+ );
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ 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
+ }
+ };
+ });
- mockRest.addHandler('put', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/feature-groups/${toBeUpdatedFeatureGroupId}`);
- expect(data).toEqual(FeatureGroupPutFactoryRequest);
- expect(options).toEqual(undefined);
- return {returnCode: 'OK'};
- });
+ mockRest.addHandler('fetch', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}`
+ );
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {
+ ...returnedVersionFields
+ };
+ });
- mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/entitlement-pools`);
- expect(data).toEqual(undefined);
- expect(options).toEqual(undefined);
- return {results: []};
- });
+ return FeatureGroupsActionHelper.saveFeatureGroup(store.dispatch, {
+ licenseModelId: LICENSE_MODEL_ID,
+ version,
+ previousFeatureGroup: previousFeatureGroupData,
+ featureGroup: featureGroupUpdateData
+ }).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
+ });
+ });
- mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-key-groups`);
- expect(data).toEqual(undefined);
- expect(options).toEqual(undefined);
- return {results: []};
- });
+ it('Open Editor', () => {
+ const store = storeCreator();
+ deepFreeze(store.getState());
- 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}};
- });
+ const editorData = FeatureGroupStoreFactory.build();
+ deepFreeze(editorData);
+ const LICENSE_MODEL_ID = '123';
- return FeatureGroupsActionHelper.saveFeatureGroup(store.dispatch, {
- licenseModelId: LICENSE_MODEL_ID,
- version,
- previousFeatureGroup: previousFeatureGroupData,
- featureGroup: featureGroupUpdateData
- }).then(() => {
- expect(store.getState()).toEqual(expectedStore);
- });
+ mockRest.addHandler('fetch', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${
+ version.id
+ }/entitlement-pools`
+ );
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return { results: [] };
+ });
- });
+ mockRest.addHandler('fetch', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${
+ version.id
+ }/license-key-groups`
+ );
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return { results: [] };
+ });
- it('Open Editor', () => {
-
- const store = storeCreator();
- deepFreeze(store.getState());
-
- const editorData = FeatureGroupStoreFactory.build();
- deepFreeze(editorData);
- const LICENSE_MODEL_ID = '123';
-
- mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/entitlement-pools`);
- expect(data).toEqual(undefined);
- expect(options).toEqual(undefined);
- return {results: []};
- });
-
- mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-key-groups`);
- expect(data).toEqual(undefined);
- expect(options).toEqual(undefined);
- return {results: []};
- });
-
-
- return FeatureGroupsActionHelper.openFeatureGroupsEditor(store.dispatch, {featureGroup: editorData, licenseModelId: '123', version}).then(() => {
- expect(store.getState().licenseModel.featureGroup.featureGroupEditor.data).toEqual(editorData);
- });
- });
-
+ return FeatureGroupsActionHelper.openFeatureGroupsEditor(
+ store.dispatch,
+ { featureGroup: editorData, licenseModelId: '123', version }
+ ).then(() => {
+ expect(
+ store.getState().licenseModel.featureGroup.featureGroupEditor
+ .data
+ ).toEqual(editorData);
+ });
+ });
});