Skip to content

Commit

Permalink
Merge pull request #39 from Chamindu36/ts-dev-migration
Browse files Browse the repository at this point in the history
Add commented testcases
  • Loading branch information
Chamindu36 committed Oct 1, 2023
2 parents a835726 + 175aafe commit ad26ba1
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions src/routes/navigation/__tests__/navigation.component.test.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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(<Navigation />, {
// preloadedState: {
// user: {
// currentUser: {},
// },
// },
// });
renderWithProviders(<Navigation />, {
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();
}
);
});

0 comments on commit ad26ba1

Please sign in to comment.