From b5915abb940e70796e071315874f060c87dfa2b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tadeusz=20Miesi=C4=85c?= <tadeusz.miesiac@gmail.com>
Date: Fri, 27 Oct 2023 12:16:42 +0800
Subject: [PATCH] test(missing test): added missing test case

---
 .../TopBar/TopBar.component.test.tsx          | 22 ++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/components/FunctionalArea/TopBar/TopBar.component.test.tsx b/src/components/FunctionalArea/TopBar/TopBar.component.test.tsx
index e6e44ac1..ae9f17c9 100644
--- a/src/components/FunctionalArea/TopBar/TopBar.component.test.tsx
+++ b/src/components/FunctionalArea/TopBar/TopBar.component.test.tsx
@@ -1,10 +1,14 @@
 import { StoreType } from '@/redux/store';
-import { getReduxWrapperWithStore } from '@/utils/testing/getReduxWrapperWithStore';
+import {
+  InitialStoreState,
+  getReduxWrapperWithStore,
+} from '@/utils/testing/getReduxWrapperWithStore';
 import { render, screen } from '@testing-library/react';
+import { initialStateFixture } from '@/redux/drawer/drawerFixture';
 import { TopBar } from './TopBar.component';
 
-const renderComponent = (): { store: StoreType } => {
-  const { Wrapper, store } = getReduxWrapperWithStore();
+const renderComponent = (initialStoreState: InitialStoreState = {}): { store: StoreType } => {
+  const { Wrapper, store } = getReduxWrapperWithStore(initialStoreState);
 
   return (
     render(
@@ -25,4 +29,16 @@ describe('TopBar - component', () => {
     expect(screen.getByTestId('user-avatar')).toBeInTheDocument();
     expect(screen.getByTestId('search-bar')).toBeInTheDocument();
   });
+
+  it('should open submaps drawer on submaps button click', () => {
+    const { store } = renderComponent({ drawer: initialStateFixture });
+
+    const button = screen.getByRole('button', { name: 'Submaps' });
+    button.click();
+
+    const { isOpen, drawerName } = store.getState().drawer;
+
+    expect(isOpen).toBe(true);
+    expect(drawerName).toBe('submaps');
+  });
 });
-- 
GitLab