diff --git a/src/components/LeftDrawer/LeftDrawer.test.tsx b/src/components/LeftDrawer/LeftDrawer.test.tsx index 2a64d72f95..bd7652dab4 100644 --- a/src/components/LeftDrawer/LeftDrawer.test.tsx +++ b/src/components/LeftDrawer/LeftDrawer.test.tsx @@ -5,7 +5,6 @@ import 'jest-localstorage-mock'; import { I18nextProvider } from 'react-i18next'; import { BrowserRouter } from 'react-router-dom'; -import { toast } from 'react-toastify'; import i18nForTest from 'utils/i18nForTest'; import type { InterfaceLeftDrawerProps } from './LeftDrawer'; import LeftDrawer from './LeftDrawer'; @@ -89,7 +88,6 @@ describe('Testing Left Drawer component for SUPERADMIN', () => { // Coming soon userEvent.click(screen.getByTestId(/profileBtn/i)); - expect(toast.success).toHaveBeenCalledWith('Profile page coming soon!'); // Send to roles screen userEvent.click(rolesBtn); @@ -234,7 +232,6 @@ describe('Testing Left Drawer component for ADMIN', () => { // Coming soon userEvent.click(screen.getByTestId(/profileBtn/i)); - expect(toast.success).toHaveBeenCalledWith('Profile page coming soon!'); // Send to roles screen userEvent.click(orgsBtn); diff --git a/src/components/LeftDrawerEvent/LeftDrawerEvent.test.tsx b/src/components/LeftDrawerEvent/LeftDrawerEvent.test.tsx index 0fabcd2c55..889ba7fea6 100644 --- a/src/components/LeftDrawerEvent/LeftDrawerEvent.test.tsx +++ b/src/components/LeftDrawerEvent/LeftDrawerEvent.test.tsx @@ -4,7 +4,6 @@ import userEvent from '@testing-library/user-event'; import 'jest-localstorage-mock'; import { I18nextProvider } from 'react-i18next'; import { BrowserRouter } from 'react-router-dom'; -import { toast } from 'react-toastify'; import i18nForTest from 'utils/i18nForTest'; import LeftDrawerEvent, { type InterfaceLeftDrawerProps, @@ -138,7 +137,6 @@ describe('Testing Left Drawer component for the Event Dashboard', () => { expect(props.setShowAddEventProjectModal).toHaveBeenCalled(); fireEvent.click(queryByTestId(/profileBtn/i) as HTMLElement); - expect(toast.success).toHaveBeenCalledWith('Profile page coming soon!'); }); test('Testing Drawer when hideDrawer is null', () => { diff --git a/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx b/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx index ff10c1b28b..4d4d0db4b5 100644 --- a/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx +++ b/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx @@ -5,7 +5,6 @@ import 'jest-localstorage-mock'; import { I18nextProvider } from 'react-i18next'; import { BrowserRouter } from 'react-router-dom'; -import { toast } from 'react-toastify'; import i18nForTest from 'utils/i18nForTest'; import type { InterfaceLeftDrawerProps } from './LeftDrawerOrg'; import LeftDrawerOrg from './LeftDrawerOrg'; @@ -267,7 +266,6 @@ describe('Testing Left Drawer component for SUPERADMIN', () => { await wait(); expect(screen.getByTestId(/orgBtn/i)).toBeInTheDocument(); userEvent.click(screen.getByTestId(/profileBtn/i)); - expect(toast.success).toHaveBeenCalledWith('Profile page coming soon!'); }); test('Testing Menu Buttons', async () => { diff --git a/src/components/UserUpdate/UserUpdate.test.tsx b/src/components/UserUpdate/UserUpdate.test.tsx index 7b627367a9..aca8a579a2 100644 --- a/src/components/UserUpdate/UserUpdate.test.tsx +++ b/src/components/UserUpdate/UserUpdate.test.tsx @@ -3,12 +3,13 @@ import { act, render, screen } from '@testing-library/react'; import { MockedProvider } from '@apollo/react-testing'; import userEvent from '@testing-library/user-event'; import { I18nextProvider } from 'react-i18next'; - +import { BrowserRouter as Router } from 'react-router-dom'; import UserUpdate from './UserUpdate'; import { UPDATE_USER_MUTATION } from 'GraphQl/Mutations/mutations'; import i18nForTest from 'utils/i18nForTest'; import { USER_DETAILS } from 'GraphQl/Queries/Queries'; import { StaticMockLink } from 'utils/StaticMockLink'; +import { toast } from 'react-toastify'; const MOCKS = [ { @@ -95,7 +96,9 @@ describe('Testing User Update', () => { render( - + + + ); @@ -131,4 +134,25 @@ describe('Testing User Update', () => { expect(screen.getByPlaceholderText(/Email/i)).toBeInTheDocument(); expect(screen.getByText(/Display Image/i)).toBeInTheDocument(); }); + test('should display warnings for blank form submission', async () => { + jest.spyOn(toast, 'warning'); + + render( + + + + + + + + ); + + await wait(); + + userEvent.click(screen.getByText(/Save Changes/i)); + + expect(toast.warning).toHaveBeenCalledWith('First Name cannot be blank!'); + expect(toast.warning).toHaveBeenCalledWith('Last Name cannot be blank!'); + expect(toast.warning).toHaveBeenCalledWith('Email cannot be blank!'); + }); }); diff --git a/src/screens/MemberDetail/MemberDetail.test.tsx b/src/screens/MemberDetail/MemberDetail.test.tsx index 94fd20700e..6a52ba41c5 100644 --- a/src/screens/MemberDetail/MemberDetail.test.tsx +++ b/src/screens/MemberDetail/MemberDetail.test.tsx @@ -270,6 +270,6 @@ describe('MemberDetail', () => { expect(container.textContent).not.toBe('Loading data...'); - waitFor(() => userEvent.click(screen.getByText(/edit/i))); + waitFor(() => userEvent.click(screen.getByText(/Edit Profile/i))); }); });