From 6f40fdd000a216040899feb19954638c10e8794e Mon Sep 17 00:00:00 2001 From: CD Cabrera Date: Mon, 6 Apr 2020 17:10:39 -0400 Subject: [PATCH] DEV routerTypes * add optin routing * apply error routing towards optin --- .../__snapshots__/router.test.js.snap | 4 +-- .../__snapshots__/routerHelpers.test.js.snap | 19 +++++++++++- .../__snapshots__/routerTypes.test.js.snap | 12 ++++--- .../router/__tests__/routerHelpers.test.js | 14 ++++++++- .../router/__tests__/routerTypes.test.js | 5 +-- src/components/router/routerTypes.js | 31 ++++++++++++++----- 6 files changed, 67 insertions(+), 18 deletions(-) diff --git a/src/components/router/__tests__/__snapshots__/router.test.js.snap b/src/components/router/__tests__/__snapshots__/router.test.js.snap index 4f5b7de15..feea9ceb1 100644 --- a/src/components/router/__tests__/__snapshots__/router.test.js.snap +++ b/src/components/router/__tests__/__snapshots__/router.test.js.snap @@ -45,8 +45,8 @@ exports[`Router Component should render a basic component: basic 1`] = ` /> { it('should return specific properties', () => { expect(baseName).toBeDefined(); expect(dynamicBaseName).toBeDefined(); + expect(getErrorRoute).toBeDefined(); expect(getNavigationDetail).toBeDefined(); expect(getRouteDetail).toBeDefined(); expect(getNavRouteDetail).toBeDefined(); @@ -61,6 +69,10 @@ describe('RouterHelpers', () => { ).toMatchSnapshot('beta app lorem route name'); }); + it('should return an error route', () => { + expect(getErrorRoute).toMatchSnapshot('error route'); + }); + it('should return navigation and route details that align to location', () => { expect({ nav: getNavigationDetail({ id: 'soon' }), diff --git a/src/components/router/__tests__/routerTypes.test.js b/src/components/router/__tests__/routerTypes.test.js index 96db2c525..abce41dcd 100644 --- a/src/components/router/__tests__/routerTypes.test.js +++ b/src/components/router/__tests__/routerTypes.test.js @@ -1,10 +1,11 @@ -import { appName, navigation, platformRedirect, routes } from '../routerTypes'; +import { appName, navigation, platformLandingRedirect, platformModalRedirect, routes } from '../routerTypes'; describe('RouterTypes', () => { it('should return specific properties', () => { expect(appName).toMatchSnapshot('appName'); expect(navigation).toMatchSnapshot('navigation'); - expect(platformRedirect).toMatchSnapshot('platformRedirect'); + expect(platformLandingRedirect).toMatchSnapshot('platformLandingRedirect'); + expect(platformModalRedirect).toMatchSnapshot('platformModalRedirect'); expect(routes).toMatchSnapshot('routes'); }); }); diff --git a/src/components/router/routerTypes.js b/src/components/router/routerTypes.js index a00882913..e8e4d8da3 100644 --- a/src/components/router/routerTypes.js +++ b/src/components/router/routerTypes.js @@ -1,6 +1,7 @@ import path from 'path'; import { helpers } from '../../common/helpers'; import OpenshiftView from '../openshiftView/openshiftView'; +import OptinView from '../optinView/optinView'; import RhelView from '../rhelView/rhelView'; import TourView from '../tourView/tourView'; import { RHSM_API_PATH_ID_TYPES } from '../../types/rhsmApiTypes'; @@ -17,7 +18,14 @@ const appName = helpers.UI_NAME; * * @returns {Array} */ -const platformRedirect = path.join(helpers.UI_DEPLOY_PATH_PREFIX, '/?not_entitled=subscriptions'); +const platformLandingRedirect = path.join(helpers.UI_DEPLOY_PATH_PREFIX, '/'); + +/** + * Return a string that describes a platform redirect. + * + * @returns {Array} + */ +const platformModalRedirect = path.join(helpers.UI_DEPLOY_PATH_PREFIX, '/?not_entitled=subscriptions'); /** * Return array of objects that describes routing. @@ -55,15 +63,15 @@ const routes = [ component: TourView, exact: true, render: true, - activateOnError: true, disabled: helpers.UI_DISABLED }, { - id: 'tour', - to: '/tour', - component: TourView, + id: 'optin', + to: '/optin', + component: OptinView, exact: true, render: true, + activateOnError: true, disabled: helpers.UI_DISABLED } ]; @@ -116,8 +124,17 @@ const navigation = [ const routerTypes = { appName, navigation, - platformRedirect, + platformLandingRedirect, + platformModalRedirect, routes }; -export { routerTypes as default, routerTypes, appName, navigation, platformRedirect, routes }; +export { + routerTypes as default, + routerTypes, + appName, + navigation, + platformLandingRedirect, + platformModalRedirect, + routes +};