From 175aafe483dd96ffa940c96e9eb3c8b301a0c275 Mon Sep 17 00:00:00 2001 From: Chamindu Date: Sun, 1 Oct 2023 19:28:15 +0530 Subject: [PATCH] Add commented testcases --- .../__tests__/navigation.component.test.js | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/routes/navigation/__tests__/navigation.component.test.js b/src/routes/navigation/__tests__/navigation.component.test.js index 8a0f034..750edfb 100644 --- a/src/routes/navigation/__tests__/navigation.component.test.js +++ b/src/routes/navigation/__tests__/navigation.component.test.js @@ -1,4 +1,3 @@ -import React from 'react'; import * as reactRedux from 'react-redux'; import { screen, fireEvent } from '@testing-library/react'; import { renderWithProviders } from '../../../utils/test/test.utils'; @@ -69,24 +68,24 @@ describe('Navigation tests', () => { expect(screen.queryByText('Your cart is empty')).toBeNull(); }); - // test('It should dispatch SignOutStart when Sign Out is clicked', () => { - // const mockDispatch = jest.fn(); - // jest.spyOn(reactRedux, 'useDispatch').mockReturnValue(mockDispatch); + test('It should dispatch SignOutStart when Sign Out is clicked', () => { + const mockDispatch = jest.fn(); + jest.spyOn(reactRedux, 'useDispatch').mockReturnValue(mockDispatch); - // renderWithProviders(, { - // preloadedState: { - // user: { - // currentUser: {}, - // }, - // }, - // }); + renderWithProviders(, { + preloadedState: { + user: { + currentUser: {}, + }, + }, + }); - // const signOutButton = screen.getByText('SIGN OUT'); - // fireEvent.click(signOutButton); + const signOutButton = screen.getByText('SIGN OUT'); + fireEvent.click(signOutButton); - // const signoutAction = SignOutStart(); - // expect(mockDispatch).toHaveBeenCalledWith(signoutAction); - // mockDispatch.mockClear(); - // } - // ); + const signoutAction = SignOutStart(); + expect(mockDispatch).toHaveBeenCalledWith(signoutAction); + mockDispatch.mockClear(); + } + ); }); \ No newline at end of file