aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-ui/test/onboard
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-ui/test/onboard')
-rw-r--r--openecomp-ui/test/onboard/filter/filter.test.js14
-rw-r--r--openecomp-ui/test/onboard/test.js30
2 files changed, 37 insertions, 7 deletions
diff --git a/openecomp-ui/test/onboard/filter/filter.test.js b/openecomp-ui/test/onboard/filter/filter.test.js
index 1b89a306bf..bf9ce63346 100644
--- a/openecomp-ui/test/onboard/filter/filter.test.js
+++ b/openecomp-ui/test/onboard/filter/filter.test.js
@@ -24,7 +24,8 @@ import {
import { FilterFactory } from 'test-utils/factories/onboard/FilterFactories.js';
import {
itemStatus,
- versionStatus
+ versionStatus,
+ itemPermissions
} from 'sdc-app/common/helpers/ItemsHelperConstants.js';
import OnboardActionHelper from 'sdc-app/onboarding/onboard/OnboardActionHelper.js';
import { tabsMapping } from 'sdc-app/onboarding/onboard/OnboardConstants.js';
@@ -46,7 +47,9 @@ describe('Onboard Filter Tests', () => {
expect(baseUrl).toEqual(
`/onboarding-api/v1.0/items?&itemStatus=${
itemStatus.ACTIVE
- }&versionStatus=${versionStatus.DRAFT}`
+ }&versionStatus=${versionStatus.DRAFT}&permission=${
+ itemPermissions.OWNER
+ },${itemPermissions.CONTRIBUTOR}`
);
expect(data).toEqual(undefined);
expect(options).toEqual(undefined);
@@ -62,10 +65,7 @@ describe('Onboard Filter Tests', () => {
done();
});
});
- /**
- * TODO Turn ON when FILTER TOGGLE Will BE REMOVED
- */
- /*
+
it('load certifed data', done => {
const store = storeCreator();
@@ -112,7 +112,7 @@ describe('Onboard Filter Tests', () => {
done();
});
});
- */
+
it('onboarding tabs switching filter updates', done => {
const store = storeCreator();
diff --git a/openecomp-ui/test/onboard/test.js b/openecomp-ui/test/onboard/test.js
index a75070bf26..b2131ceed5 100644
--- a/openecomp-ui/test/onboard/test.js
+++ b/openecomp-ui/test/onboard/test.js
@@ -20,6 +20,11 @@ import OnboardingCatalogActionHelper from 'sdc-app/onboarding/onboard/onboarding
import { tabsMapping as onboardTabsMapping } from 'sdc-app/onboarding/onboard/OnboardConstants.js';
import { tabsMapping as onboardCatalogTabsMapping } from 'sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogConstants.js';
import { FilterFactory } from 'test-utils/factories/onboard/FilterFactories.js';
+import mockRest from 'test-utils/MockRest.js';
+import {
+ itemStatus,
+ versionStatus
+} from 'sdc-app/common/helpers/ItemsHelperConstants.js';
describe('Onboard Module Tests', () => {
it('should return default state', () => {
@@ -34,6 +39,18 @@ describe('Onboard Module Tests', () => {
activeTab: onboardTabsMapping.CATALOG,
filter: FilterFactory.build({ versionStatus: 'Certified' })
});
+
+ mockRest.addHandler('fetch', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `/onboarding-api/v1.0/items?&itemStatus=${
+ itemStatus.ACTIVE
+ }&versionStatus=${versionStatus.CERTIFIED}`
+ );
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return { results: [] };
+ });
+
OnboardActionHelper.changeActiveTab(
store.dispatch,
onboardTabsMapping.CATALOG
@@ -62,6 +79,18 @@ describe('Onboard Module Tests', () => {
const store = storeCreator();
const expectedStore = OnboardStoreFactory.build();
OnboardActionHelper.changeSearchValue(store.dispatch, 'hello');
+
+ mockRest.addHandler('fetch', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `/onboarding-api/v1.0/items?&itemStatus=${
+ itemStatus.ACTIVE
+ }&versionStatus=${versionStatus.CERTIFIED}`
+ );
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return { results: [] };
+ });
+
OnboardActionHelper.changeActiveTab(
store.dispatch,
onboardTabsMapping.CATALOG
@@ -70,6 +99,7 @@ describe('Onboard Module Tests', () => {
store.dispatch,
onboardCatalogTabsMapping.ACTIVE
);
+
OnboardActionHelper.resetOnboardStore(store.dispatch, 'hello');
expect(store.getState().onboard).toEqual(expectedStore);
});