From 07e0ec8f6df734d840441e27cac9891b00fa27aa Mon Sep 17 00:00:00 2001 From: eemaanamir Date: Mon, 4 Nov 2024 15:16:36 +0500 Subject: [PATCH] test: updated tests --- src/data/reducers.js | 7 +++---- src/routes/AppRoutes.jsx | 8 +++++--- src/routes/routes.test.jsx | 20 ++++++++------------ 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/data/reducers.js b/src/data/reducers.js index c2ff27178..c5b3b97f1 100755 --- a/src/data/reducers.js +++ b/src/data/reducers.js @@ -5,9 +5,8 @@ import { reducer as NewProfilePageReducer } from '../profile-v2'; const isNewProfileEnabled = process.env.ENABLE_NEW_PROFILE_VIEW === 'true'; -const createRootReducer = () => - combineReducers({ - profilePage: isNewProfileEnabled ? NewProfilePageReducer : profilePage, - }); +const createRootReducer = () => combineReducers({ + profilePage: isNewProfileEnabled ? NewProfilePageReducer : profilePage, +}); export default createRootReducer; diff --git a/src/routes/AppRoutes.jsx b/src/routes/AppRoutes.jsx index fb0877cb3..42658b8a4 100644 --- a/src/routes/AppRoutes.jsx +++ b/src/routes/AppRoutes.jsx @@ -14,9 +14,11 @@ const AppRoutes = () => ( - {isNewProfileEnabled ? : } - + ( + + {isNewProfileEnabled ? : } + + ) } /> ({ getLoginRedirectUrl: jest.fn(), })); -const isNewProfileEnabled = process.env.ENABLE_NEW_PROFILE_VIEW === 'true'; +jest.mock('../profile', () => ({ + ProfilePage: () => (
Profile page
), + NotFoundPage: () => (
Not found page
), +})); -if (isNewProfileEnabled) { - jest.mock('../profile-v2', () => ({ - ProfilePage: () => (
New Profile page
), - NotFoundPage: () => (
New Not found page
), - })); -} else { - jest.mock('../profile', () => ({ - ProfilePage: () => (
Profile page
), - NotFoundPage: () => (
Not found page
), - })); -} +jest.mock('../profile-v2', () => ({ + ProfilePage: () => (
Profile page
), + NotFoundPage: () => (
Not found page
), +})); const RoutesWithProvider = (context, path) => (