From 7da012fc8b5a55a17f901cb8797f00db81d49dd3 Mon Sep 17 00:00:00 2001
From: mateuszmiko <dmastah92@gmail.com>
Date: Mon, 16 Oct 2023 16:09:21 +0200
Subject: [PATCH] feat: search drawer stepper (MIN-97)

---
 .../NavBar/NavBar.component.tsx               |   6 +-
 .../TopBar/SearchBar/SearchBar.component.tsx  |   3 +-
 .../Map/Drawer/Drawer.component.test.tsx      |   4 +-
 .../Map/Drawer/Drawer.component.tsx           |   6 +-
 .../DrugsAccordion.component.test.tsx         |   6 +-
 .../SearchDrawerWrapper.component.test.tsx    | 116 ++++++++++++++++++
 .../SearchDrawerWrapper.component.tsx         |  38 ++++++
 .../SearchDrawerWrapper.constants.ts          |   5 +
 .../Map/Drawer/SearchDrawerWrapper/index.ts   |   1 +
 src/constants/index.ts                        |   2 +
 src/redux/drawer/drawer.reducers.test.ts      |  64 +++++++++-
 src/redux/drawer/drawer.reducers.ts           |  26 +++-
 src/redux/drawer/drawer.selectors.ts          |  23 +++-
 src/redux/drawer/drawer.slice.ts              |  21 +++-
 src/redux/drawer/drawer.types.ts              |  38 +++++-
 src/redux/store.ts                            |   2 +-
 ...erHeadingBackwardButton.component.test.tsx |   6 +-
 src/types/drawerName.ts                       |   1 +
 src/types/pathName.ts                         |   1 -
 .../testing/getReduxWrapperWithStore.tsx      |   8 +-
 20 files changed, 345 insertions(+), 32 deletions(-)
 create mode 100644 src/components/Map/Drawer/SearchDrawerWrapper/SearchDrawerWrapper.component.test.tsx
 create mode 100644 src/components/Map/Drawer/SearchDrawerWrapper/SearchDrawerWrapper.component.tsx
 create mode 100644 src/components/Map/Drawer/SearchDrawerWrapper/SearchDrawerWrapper.constants.ts
 create mode 100644 src/components/Map/Drawer/SearchDrawerWrapper/index.ts
 create mode 100644 src/types/drawerName.ts
 delete mode 100644 src/types/pathName.ts

diff --git a/src/components/FunctionalArea/NavBar/NavBar.component.tsx b/src/components/FunctionalArea/NavBar/NavBar.component.tsx
index 14af6635..6783d04b 100644
--- a/src/components/FunctionalArea/NavBar/NavBar.component.tsx
+++ b/src/components/FunctionalArea/NavBar/NavBar.component.tsx
@@ -1,9 +1,9 @@
-import Image from 'next/image';
-import { IconButton } from '@/shared/IconButton';
 import logoImg from '@/assets/images/logo.png';
 import luxembourgLogoImg from '@/assets/images/luxembourg-logo.png';
-import { useAppDispatch } from '@/redux/hooks/useAppDispatch';
 import { openDrawer } from '@/redux/drawer/drawer.slice';
+import { useAppDispatch } from '@/redux/hooks/useAppDispatch';
+import { IconButton } from '@/shared/IconButton';
+import Image from 'next/image';
 
 export const NavBar = (): JSX.Element => {
   const dispatch = useAppDispatch();
diff --git a/src/components/FunctionalArea/TopBar/SearchBar/SearchBar.component.tsx b/src/components/FunctionalArea/TopBar/SearchBar/SearchBar.component.tsx
index 77ec065c..66f5fc8f 100644
--- a/src/components/FunctionalArea/TopBar/SearchBar/SearchBar.component.tsx
+++ b/src/components/FunctionalArea/TopBar/SearchBar/SearchBar.component.tsx
@@ -1,6 +1,6 @@
 import lensIcon from '@/assets/vectors/icons/lens.svg';
 import { isDrawerOpenSelector } from '@/redux/drawer/drawer.selectors';
-import { openDrawer } from '@/redux/drawer/drawer.slice';
+import { clearSearchDrawerState, openDrawer } from '@/redux/drawer/drawer.slice';
 import { useAppDispatch } from '@/redux/hooks/useAppDispatch';
 import {
   isPendingSearchStatusSelector,
@@ -25,6 +25,7 @@ export const SearchBar = (): JSX.Element => {
   const openSearchDrawerIfClosed = (): void => {
     if (!isDrawerOpen) {
       dispatch(openDrawer('search'));
+      dispatch(clearSearchDrawerState());
     }
   };
 
diff --git a/src/components/Map/Drawer/Drawer.component.test.tsx b/src/components/Map/Drawer/Drawer.component.test.tsx
index 20c5630b..1741384a 100644
--- a/src/components/Map/Drawer/Drawer.component.test.tsx
+++ b/src/components/Map/Drawer/Drawer.component.test.tsx
@@ -1,7 +1,7 @@
-import { screen, render, act, fireEvent } from '@testing-library/react';
 import { openDrawer } from '@/redux/drawer/drawer.slice';
-import { getReduxWrapperWithStore } from '@/utils/testing/getReduxWrapperWithStore';
 import { StoreType } from '@/redux/store';
+import { getReduxWrapperWithStore } from '@/utils/testing/getReduxWrapperWithStore';
+import { act, fireEvent, render, screen } from '@testing-library/react';
 import { Drawer } from './Drawer.component';
 
 const renderComponent = (): { store: StoreType } => {
diff --git a/src/components/Map/Drawer/Drawer.component.tsx b/src/components/Map/Drawer/Drawer.component.tsx
index a08fd813..52f4a1d5 100644
--- a/src/components/Map/Drawer/Drawer.component.tsx
+++ b/src/components/Map/Drawer/Drawer.component.tsx
@@ -1,8 +1,8 @@
-import dynamic from 'next/dynamic';
-import { twMerge } from 'tailwind-merge';
-import { useAppSelector } from '@/redux/hooks/useAppSelector';
 import { DRAWER_ROLE } from '@/components/Map/Drawer/Drawer.constants';
 import { drawerSelector } from '@/redux/drawer/drawer.selectors';
+import { useAppSelector } from '@/redux/hooks/useAppSelector';
+import dynamic from 'next/dynamic';
+import { twMerge } from 'tailwind-merge';
 
 const SearchDrawerContent = dynamic(
   async () =>
diff --git a/src/components/Map/Drawer/SearchDrawerContent/DrugsAccordion/DrugsAccordion.component.test.tsx b/src/components/Map/Drawer/SearchDrawerContent/DrugsAccordion/DrugsAccordion.component.test.tsx
index 5abedd8f..c1d1f6fe 100644
--- a/src/components/Map/Drawer/SearchDrawerContent/DrugsAccordion/DrugsAccordion.component.test.tsx
+++ b/src/components/Map/Drawer/SearchDrawerContent/DrugsAccordion/DrugsAccordion.component.test.tsx
@@ -1,11 +1,11 @@
-import { render, screen } from '@testing-library/react';
+import { drugsFixture } from '@/models/fixtures/drugFixtures';
 import { StoreType } from '@/redux/store';
+import { Accordion } from '@/shared/Accordion';
 import {
   InitialStoreState,
   getReduxWrapperWithStore,
 } from '@/utils/testing/getReduxWrapperWithStore';
-import { drugsFixture } from '@/models/fixtures/drugFixtures';
-import { Accordion } from '@/shared/Accordion';
+import { render, screen } from '@testing-library/react';
 import { DrugsAccordion } from './DrugsAccordion.component';
 
 const renderComponent = (initialStoreState: InitialStoreState = {}): { store: StoreType } => {
diff --git a/src/components/Map/Drawer/SearchDrawerWrapper/SearchDrawerWrapper.component.test.tsx b/src/components/Map/Drawer/SearchDrawerWrapper/SearchDrawerWrapper.component.test.tsx
new file mode 100644
index 00000000..19c588d7
--- /dev/null
+++ b/src/components/Map/Drawer/SearchDrawerWrapper/SearchDrawerWrapper.component.test.tsx
@@ -0,0 +1,116 @@
+import { SearchDrawerWrapper } from '@/components/Map/Drawer/SearchDrawerWrapper';
+import { StoreType } from '@/redux/store';
+import {
+  InitialStoreState,
+  getReduxWrapperWithStore,
+} from '@/utils/testing/getReduxWrapperWithStore';
+import { render, screen } from '@testing-library/react';
+
+const renderComponent = (initialStoreState: InitialStoreState = {}): { store: StoreType } => {
+  const { Wrapper, store } = getReduxWrapperWithStore(initialStoreState);
+
+  return (
+    render(
+      <Wrapper>
+        <SearchDrawerWrapper />
+      </Wrapper>,
+    ),
+    {
+      store,
+    }
+  );
+};
+
+describe('SearchDrawerWrapper - component', () => {
+  it('should display the first step for search', () => {
+    renderComponent({
+      drawer: {
+        isOpen: true,
+        drawerName: 'search',
+        searchDrawerState: {
+          currentStep: 1,
+          selectedValue: {
+            name: '',
+            valueType: 'none',
+          },
+        },
+      },
+    });
+
+    expect(screen.getByTestId('search-first-step')).toBeInTheDocument();
+  });
+
+  it('should display the second step for value type bioEntity', () => {
+    renderComponent({
+      drawer: {
+        isOpen: true,
+        drawerName: 'search',
+        searchDrawerState: {
+          currentStep: 2,
+          selectedValue: {
+            model: { name: 'test model bioEntity', id: 'test-id' },
+            name: 'bio entity second step',
+            valueType: 'bioEntity',
+          },
+        },
+      },
+    });
+
+    expect(screen.getByTestId('search-second-step')).toBeInTheDocument();
+  });
+
+  it('should display the second step for value type chemicals', () => {
+    renderComponent({
+      drawer: {
+        isOpen: true,
+        drawerName: 'search',
+        searchDrawerState: {
+          currentStep: 2,
+          selectedValue: {
+            name: 'chemicals second step',
+            valueType: 'chemicals',
+          },
+        },
+      },
+    });
+
+    expect(screen.getByTestId('search-second-step')).toBeInTheDocument();
+  });
+
+  it('should display the third step for value type bioEntity', () => {
+    renderComponent({
+      drawer: {
+        isOpen: true,
+        drawerName: 'search',
+        searchDrawerState: {
+          currentStep: 3,
+          selectedValue: {
+            model: { name: 'test model bioEntity', id: 'test-id' },
+            name: 'bio entity third step',
+            valueType: 'bioEntity',
+          },
+        },
+      },
+    });
+
+    expect(screen.getByTestId('search-third-step')).toBeInTheDocument();
+  });
+
+  it('should display the third step for value type chemicals', () => {
+    renderComponent({
+      drawer: {
+        isOpen: true,
+        drawerName: 'search',
+        searchDrawerState: {
+          currentStep: 3,
+          selectedValue: {
+            name: 'chemicals third step',
+            valueType: 'chemicals',
+          },
+        },
+      },
+    });
+
+    expect(screen.getByTestId('search-third-step')).toBeInTheDocument();
+  });
+});
diff --git a/src/components/Map/Drawer/SearchDrawerWrapper/SearchDrawerWrapper.component.tsx b/src/components/Map/Drawer/SearchDrawerWrapper/SearchDrawerWrapper.component.tsx
new file mode 100644
index 00000000..9ce500cf
--- /dev/null
+++ b/src/components/Map/Drawer/SearchDrawerWrapper/SearchDrawerWrapper.component.tsx
@@ -0,0 +1,38 @@
+import { STEP } from '@/components/Map/Drawer/SearchDrawerWrapper/SearchDrawerWrapper.constants';
+import { BIO_ENTITY, DRUGS_CHEMICALS_MIRNA } from '@/constants';
+import {
+  currentStepDrawerStateSelector,
+  valueTypeDrawerSelector,
+} from '@/redux/drawer/drawer.selectors';
+import { useSelector } from 'react-redux';
+
+export const SearchDrawerWrapper = (): JSX.Element => {
+  const currentStep = useSelector(currentStepDrawerStateSelector);
+  const valueType = useSelector(valueTypeDrawerSelector);
+
+  const isBioEntityType = valueType === BIO_ENTITY;
+  const isChemicalsDrugsOrMirnaType = DRUGS_CHEMICALS_MIRNA.includes(valueType);
+
+  return (
+    <div>
+      {/* first step for displaying search results, drawers etc */}
+      {currentStep === STEP.FIRST && <div data-testid="search-first-step">The first step</div>}
+      {/* 2nd step for bioEntities aka content */}
+      {currentStep === STEP.SECOND && isBioEntityType && (
+        <div data-testid="search-second-step">The second step</div>
+      )}
+      {/* 2nd step for drugs,chemicals,mirna */}
+      {currentStep === STEP.SECOND && isChemicalsDrugsOrMirnaType && (
+        <div data-testid="search-second-step">The second step</div>
+      )}
+      {/* last step for bioentity */}
+      {currentStep === STEP.THIRD && isBioEntityType && (
+        <div data-testid="search-third-step">The third step</div>
+      )}
+      {/* last step for drugs,chemicals,mirna */}
+      {currentStep === STEP.THIRD && isChemicalsDrugsOrMirnaType && (
+        <div data-testid="search-third-step">The third step</div>
+      )}
+    </div>
+  );
+};
diff --git a/src/components/Map/Drawer/SearchDrawerWrapper/SearchDrawerWrapper.constants.ts b/src/components/Map/Drawer/SearchDrawerWrapper/SearchDrawerWrapper.constants.ts
new file mode 100644
index 00000000..fc1b7da7
--- /dev/null
+++ b/src/components/Map/Drawer/SearchDrawerWrapper/SearchDrawerWrapper.constants.ts
@@ -0,0 +1,5 @@
+export const STEP = {
+  FIRST: 1,
+  SECOND: 2,
+  THIRD: 3,
+};
diff --git a/src/components/Map/Drawer/SearchDrawerWrapper/index.ts b/src/components/Map/Drawer/SearchDrawerWrapper/index.ts
new file mode 100644
index 00000000..ee8e9189
--- /dev/null
+++ b/src/components/Map/Drawer/SearchDrawerWrapper/index.ts
@@ -0,0 +1 @@
+export { SearchDrawerWrapper } from './SearchDrawerWrapper.component';
diff --git a/src/constants/index.ts b/src/constants/index.ts
index 43423ae1..16e892f0 100644
--- a/src/constants/index.ts
+++ b/src/constants/index.ts
@@ -1,3 +1,5 @@
 export const BASE_API_URL = process.env.NEXT_PUBLIC_BASE_API_URL || '';
 export const PROJECT_ID = process.env.NEXT_PUBLIC_PROJECT_ID || '';
 export const ZOD_SEED = 997;
+export const BIO_ENTITY = 'bioEntity';
+export const DRUGS_CHEMICALS_MIRNA = ['drugs', 'chemicals', 'mirna'];
diff --git a/src/redux/drawer/drawer.reducers.test.ts b/src/redux/drawer/drawer.reducers.test.ts
index c9aa33db..d7bf3ced 100644
--- a/src/redux/drawer/drawer.reducers.test.ts
+++ b/src/redux/drawer/drawer.reducers.test.ts
@@ -1,12 +1,24 @@
-import { AnyAction } from '@reduxjs/toolkit';
 import * as toolkitRaw from '@reduxjs/toolkit';
+import { AnyAction } from '@reduxjs/toolkit';
 import type { ToolkitStore } from '@reduxjs/toolkit/dist/configureStore';
-import drawerReducer, { openDrawer, closeDrawer } from './drawer.slice';
+import drawerReducer, {
+  clearSearchDrawerState,
+  closeDrawer,
+  openDrawer,
+  setSearchDrawerState,
+} from './drawer.slice';
 import type { DrawerState } from './drawer.types';
 
 const INITIAL_STATE: DrawerState = {
   isOpen: false,
   drawerName: 'none',
+  searchDrawerState: {
+    currentStep: 0,
+    selectedValue: {
+      name: '',
+      valueType: 'none',
+    },
+  },
 };
 
 type SliceReducerType = ToolkitStore<
@@ -54,7 +66,51 @@ describe('drawer reducer', () => {
     expect(drawerName).toEqual('none');
   });
 
-  it.skip('should update the store when you type in the search', async () => {
-    // TODO
+  it('should update the store when you choose from the drawer chemical`s first step', async () => {
+    const searchDrawerData: DrawerState['searchDrawerState'] = {
+      currentStep: 1,
+      selectedValue: {
+        name: 'chemicals frist step',
+        valueType: 'chemicals',
+      },
+    };
+
+    const { type } = await store.dispatch(setSearchDrawerState(searchDrawerData));
+    const { searchDrawerState } = store.getState().drawer;
+    const { currentStep, selectedValue } = searchDrawerState;
+
+    const currentStepToBE = 1;
+
+    expect(type).toBe('drawer/setSearchDrawerState');
+    expect(currentStep).toBe(currentStepToBE);
+    expect(selectedValue).toEqual({
+      name: 'chemicals frist step',
+      valueType: 'chemicals',
+    });
+  });
+
+  it('should update the store when you clear the search drawer state', async () => {
+    const searchDrawerData: DrawerState['searchDrawerState'] = {
+      currentStep: 1,
+      selectedValue: {
+        name: 'chemicals frist step',
+        valueType: 'chemicals',
+      },
+    };
+
+    await store.dispatch(setSearchDrawerState(searchDrawerData));
+    const { type } = await store.dispatch(clearSearchDrawerState());
+
+    const { searchDrawerState } = store.getState().drawer;
+    const { currentStep, selectedValue } = searchDrawerState;
+
+    const currentStepToBE = 0;
+
+    expect(type).toBe('drawer/clearSearchDrawerState');
+    expect(currentStep).toBe(currentStepToBE);
+    expect(selectedValue).toEqual({
+      name: '',
+      valueType: 'none',
+    });
   });
 });
diff --git a/src/redux/drawer/drawer.reducers.ts b/src/redux/drawer/drawer.reducers.ts
index ade3a5c1..e205e9a4 100644
--- a/src/redux/drawer/drawer.reducers.ts
+++ b/src/redux/drawer/drawer.reducers.ts
@@ -1,8 +1,8 @@
-import { PayloadAction } from '@reduxjs/toolkit';
-import { DrawerState } from '@/redux/drawer/drawer.types';
-import { PathName } from '@/types/pathName';
+import type { DrawerState } from '@/redux/drawer/drawer.types';
+import type { DrawerName } from '@/types/drawerName';
+import type { PayloadAction } from '@reduxjs/toolkit';
 
-export const openDrawerReducer = (state: DrawerState, action: PayloadAction<PathName>): void => {
+export const openDrawerReducer = (state: DrawerState, action: PayloadAction<DrawerName>): void => {
   state.isOpen = true;
   state.drawerName = action.payload;
 };
@@ -10,3 +10,21 @@ export const openDrawerReducer = (state: DrawerState, action: PayloadAction<Path
 export const closeDrawerReducer = (state: DrawerState): void => {
   state.isOpen = false;
 };
+
+export const setSearchDrawerStateReducer = (
+  state: DrawerState,
+  action: PayloadAction<DrawerState['searchDrawerState']>,
+): void => {
+  const { currentStep, selectedValue } = action.payload;
+
+  state.searchDrawerState.currentStep = currentStep;
+  state.searchDrawerState.selectedValue = selectedValue;
+};
+
+export const clearSearchDrawerStateReducer = (state: DrawerState): void => {
+  state.searchDrawerState.currentStep = 0;
+  state.searchDrawerState.selectedValue = {
+    name: '',
+    valueType: 'none',
+  };
+};
diff --git a/src/redux/drawer/drawer.selectors.ts b/src/redux/drawer/drawer.selectors.ts
index 0ae254bd..a622a1f6 100644
--- a/src/redux/drawer/drawer.selectors.ts
+++ b/src/redux/drawer/drawer.selectors.ts
@@ -1,5 +1,26 @@
-import { createSelector } from '@reduxjs/toolkit';
 import { rootSelector } from '@/redux/root/root.selectors';
+import { createSelector } from '@reduxjs/toolkit';
 
 export const drawerSelector = createSelector(rootSelector, state => state.drawer);
+
 export const isDrawerOpenSelector = createSelector(drawerSelector, state => state.isOpen);
+
+export const searchDrawerStateSelector = createSelector(
+  drawerSelector,
+  state => state.searchDrawerState,
+);
+
+export const currentStepDrawerStateSelector = createSelector(
+  searchDrawerStateSelector,
+  state => state.currentStep,
+);
+
+export const selectedValueDrawerSelector = createSelector(
+  searchDrawerStateSelector,
+  state => state.selectedValue,
+);
+
+export const valueTypeDrawerSelector = createSelector(
+  selectedValueDrawerSelector,
+  state => state.valueType,
+);
diff --git a/src/redux/drawer/drawer.slice.ts b/src/redux/drawer/drawer.slice.ts
index aa1f2e55..cbbe5a33 100644
--- a/src/redux/drawer/drawer.slice.ts
+++ b/src/redux/drawer/drawer.slice.ts
@@ -1,10 +1,22 @@
-import { createSlice } from '@reduxjs/toolkit';
 import { DrawerState } from '@/redux/drawer/drawer.types';
-import { openDrawerReducer, closeDrawerReducer } from './drawer.reducers';
+import { createSlice } from '@reduxjs/toolkit';
+import {
+  clearSearchDrawerStateReducer,
+  closeDrawerReducer,
+  openDrawerReducer,
+  setSearchDrawerStateReducer,
+} from './drawer.reducers';
 
 const initialState: DrawerState = {
   isOpen: false,
   drawerName: 'none',
+  searchDrawerState: {
+    currentStep: 0,
+    selectedValue: {
+      name: '',
+      valueType: 'none',
+    },
+  },
 };
 
 const drawerSlice = createSlice({
@@ -13,9 +25,12 @@ const drawerSlice = createSlice({
   reducers: {
     openDrawer: openDrawerReducer,
     closeDrawer: closeDrawerReducer,
+    setSearchDrawerState: setSearchDrawerStateReducer,
+    clearSearchDrawerState: clearSearchDrawerStateReducer,
   },
 });
 
-export const { openDrawer, closeDrawer } = drawerSlice.actions;
+export const { openDrawer, closeDrawer, setSearchDrawerState, clearSearchDrawerState } =
+  drawerSlice.actions;
 
 export default drawerSlice.reducer;
diff --git a/src/redux/drawer/drawer.types.ts b/src/redux/drawer/drawer.types.ts
index 8b4bf47a..404d0fc2 100644
--- a/src/redux/drawer/drawer.types.ts
+++ b/src/redux/drawer/drawer.types.ts
@@ -1,4 +1,40 @@
+import type { DrawerName } from '@/types/drawerName';
+
+type DrugValue = {
+  name: string;
+  valueType: 'drugs';
+};
+
+type ChemicalsValue = {
+  name: string;
+  valueType: 'chemicals';
+};
+
+type MirnaValue = {
+  name: string;
+  valueType: 'mirna';
+};
+
+type BioEntityValue = {
+  model: { name: string; id: string };
+  name: string;
+  valueType: 'bioEntity';
+};
+
+type NoneValue = {
+  name: string;
+  valueType: 'none';
+};
+
+export type SelectedValue = DrugValue | ChemicalsValue | MirnaValue | BioEntityValue | NoneValue;
+
+export type SearchDrawerState = {
+  currentStep: number;
+  selectedValue: SelectedValue;
+};
+
 export type DrawerState = {
   isOpen: boolean;
-  drawerName: 'none' | 'search' | 'project-info' | 'plugins' | 'export' | 'legend';
+  drawerName: DrawerName;
+  searchDrawerState: SearchDrawerState;
 };
diff --git a/src/redux/store.ts b/src/redux/store.ts
index 841a79b8..f3e2dc5e 100644
--- a/src/redux/store.ts
+++ b/src/redux/store.ts
@@ -1,9 +1,9 @@
 import bioEntityContentsReducer from '@/redux/bioEntityContents/bioEntityContents.slice';
 import chemicalsReducer from '@/redux/chemicals/chemicals.slice';
 import drawerReducer from '@/redux/drawer/drawer.slice';
-import modelsReducer from '@/redux/models/models.slice';
 import drugsReducer from '@/redux/drugs/drugs.slice';
 import mirnasReducer from '@/redux/mirnas/mirnas.slice';
+import modelsReducer from '@/redux/models/models.slice';
 import projectSlice from '@/redux/project/project.slice';
 import searchReducer from '@/redux/search/search.slice';
 import { configureStore } from '@reduxjs/toolkit';
diff --git a/src/shared/DrawerHeadingBackwardButton/DrawerHeadingBackwardButton.component.test.tsx b/src/shared/DrawerHeadingBackwardButton/DrawerHeadingBackwardButton.component.test.tsx
index 23e0ad5d..e35e2049 100644
--- a/src/shared/DrawerHeadingBackwardButton/DrawerHeadingBackwardButton.component.test.tsx
+++ b/src/shared/DrawerHeadingBackwardButton/DrawerHeadingBackwardButton.component.test.tsx
@@ -56,7 +56,11 @@ describe('DrawerHeadingBackwardButton - component', () => {
 
   it('should call class drawer on close button click', () => {
     const { store } = renderComponent('Title', 'value', {
-      drawer: { isOpen: true, drawerName: 'search' },
+      drawer: {
+        isOpen: true,
+        drawerName: 'search',
+        searchDrawerState: { currentStep: 0, selectedValue: { name: '', valueType: 'none' } },
+      },
     });
     expect(store.getState().drawer.isOpen).toBe(true);
 
diff --git a/src/types/drawerName.ts b/src/types/drawerName.ts
new file mode 100644
index 00000000..1ee1478d
--- /dev/null
+++ b/src/types/drawerName.ts
@@ -0,0 +1 @@
+export type DrawerName = 'none' | 'search' | 'project-info' | 'plugins' | 'export' | 'legend';
diff --git a/src/types/pathName.ts b/src/types/pathName.ts
deleted file mode 100644
index 2b61453e..00000000
--- a/src/types/pathName.ts
+++ /dev/null
@@ -1 +0,0 @@
-export type PathName = 'none' | 'search' | 'project-info' | 'plugins' | 'export' | 'legend';
diff --git a/src/utils/testing/getReduxWrapperWithStore.tsx b/src/utils/testing/getReduxWrapperWithStore.tsx
index cf6097bd..b698584c 100644
--- a/src/utils/testing/getReduxWrapperWithStore.tsx
+++ b/src/utils/testing/getReduxWrapperWithStore.tsx
@@ -1,14 +1,14 @@
-import { RootState, StoreType } from '@/redux/store';
-import { configureStore } from '@reduxjs/toolkit';
-import { Provider } from 'react-redux';
 import bioEntityContentsReducer from '@/redux/bioEntityContents/bioEntityContents.slice';
 import chemicalsReducer from '@/redux/chemicals/chemicals.slice';
 import drawerReducer from '@/redux/drawer/drawer.slice';
 import drugsReducer from '@/redux/drugs/drugs.slice';
 import mirnasReducer from '@/redux/mirnas/mirnas.slice';
+import modelsReducer from '@/redux/models/models.slice';
 import projectReducer from '@/redux/project/project.slice';
 import searchReducer from '@/redux/search/search.slice';
-import modelsReducer from '@/redux/models/models.slice';
+import { RootState, StoreType } from '@/redux/store';
+import { configureStore } from '@reduxjs/toolkit';
+import { Provider } from 'react-redux';
 
 interface WrapperProps {
   children: React.ReactNode;
-- 
GitLab