From 17d1be7bae0c73db58dce73039f1bbbb80e9f249 Mon Sep 17 00:00:00 2001 From: kanishk Date: Sat, 14 Sep 2024 12:53:30 +0530 Subject: [PATCH] upgraded testing-lib/user-event to 14.5.2 --- package-lock.json | 24 ++++++++----------- package.json | 2 +- .../core/AddOnRegister/AddOnRegister.test.tsx | 2 +- .../AdvertisementRegister.test.tsx | 8 +++---- .../AgendaCategoryContainer.test.tsx | 8 +++++-- .../AgendaItems/AgendaItemsContainer.test.tsx | 4 +++- .../EventListCard/EventListCard.test.tsx | 16 ++++++------- .../OrganizationAgendaCategory.test.tsx | 4 +++- .../CustomRecurrence.test.tsx | 4 ++-- .../RecurrenceOptions.test.tsx | 4 ++-- .../TableLoader/TableLoader.test.tsx | 2 +- .../UserPortal/PostCard/PostCard.test.tsx | 6 +++-- .../UserPortal/Register/Register.test.tsx | 14 +++++------ .../StartPostModal/StartPostModal.test.tsx | 10 +++++--- .../UsersTableItem/UserTableItem.test.tsx | 12 +++++----- src/screens/ManageTag/ManageTag.test.tsx | 4 +++- .../OrganizationDashboard.test.tsx | 2 +- .../OrganizationEvents.test.tsx | 10 ++++---- .../OrganizationTags.test.tsx | 8 +++++-- src/screens/SubTags/SubTags.test.tsx | 8 +++++-- src/screens/UserPortal/Events/Events.test.tsx | 4 ++-- 21 files changed, 88 insertions(+), 68 deletions(-) diff --git a/package-lock.json b/package-lock.json index cfd7133b84..acf779d61b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -65,7 +65,7 @@ "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "@testing-library/jest-dom": "^6.5.0", "@testing-library/react": "^16.0.0", - "@testing-library/user-event": "^12.1.10", + "@testing-library/user-event": "^14.5.2", "@types/inquirer": "^9.0.7", "@types/jest": "^26.0.24", "@types/js-cookie": "^3.0.6", @@ -5724,15 +5724,13 @@ } }, "node_modules/@testing-library/user-event": { - "version": "12.8.3", - "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-12.8.3.tgz", - "integrity": "sha512-IR0iWbFkgd56Bu5ZI/ej8yQwrkCv8Qydx6RzwbKz9faXazR/+5tvYKsZQgyXJiwgpcva127YO6JcWy7YlCfofQ==", + "version": "14.5.2", + "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.5.2.tgz", + "integrity": "sha512-YAh82Wh4TIrxYLmfGcixwD18oIjyC1pFQC2Y01F2lzV2HTMiYrI0nze0FD0ocB//CKS/7jIUgae+adPqxK5yCQ==", "dev": true, - "dependencies": { - "@babel/runtime": "^7.12.5" - }, + "license": "MIT", "engines": { - "node": ">=10", + "node": ">=12", "npm": ">=6" }, "peerDependencies": { @@ -29418,13 +29416,11 @@ } }, "@testing-library/user-event": { - "version": "12.8.3", - "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-12.8.3.tgz", - "integrity": "sha512-IR0iWbFkgd56Bu5ZI/ej8yQwrkCv8Qydx6RzwbKz9faXazR/+5tvYKsZQgyXJiwgpcva127YO6JcWy7YlCfofQ==", + "version": "14.5.2", + "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.5.2.tgz", + "integrity": "sha512-YAh82Wh4TIrxYLmfGcixwD18oIjyC1pFQC2Y01F2lzV2HTMiYrI0nze0FD0ocB//CKS/7jIUgae+adPqxK5yCQ==", "dev": true, - "requires": { - "@babel/runtime": "^7.12.5" - } + "requires": {} }, "@tootallnate/once": { "version": "1.1.2", diff --git a/package.json b/package.json index 05624018b8..b4f41dfc08 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "@testing-library/jest-dom": "^6.5.0", "@testing-library/react": "^16.0.0", - "@testing-library/user-event": "^12.1.10", + "@testing-library/user-event": "^14.5.2", "@types/inquirer": "^9.0.7", "@types/jest": "^26.0.24", "@types/js-cookie": "^3.0.6", diff --git a/src/components/AddOn/core/AddOnRegister/AddOnRegister.test.tsx b/src/components/AddOn/core/AddOnRegister/AddOnRegister.test.tsx index b04b450977..dc6a7c2091 100644 --- a/src/components/AddOn/core/AddOnRegister/AddOnRegister.test.tsx +++ b/src/components/AddOn/core/AddOnRegister/AddOnRegister.test.tsx @@ -155,7 +155,7 @@ describe('Testing AddOnRegister', () => { userEvent.click(screen.getByTestId('addonregisterBtn')); await wait(100); - expect(toast.success).toBeCalledWith('Plugin added Successfully'); + expect(toast.success).toHaveBeenCalledWith('Plugin added Successfully'); }); test('Expect the window to reload after successful plugin addition', async () => { diff --git a/src/components/Advertisements/core/AdvertisementRegister/AdvertisementRegister.test.tsx b/src/components/Advertisements/core/AdvertisementRegister/AdvertisementRegister.test.tsx index 1bf16ec76b..0646a94819 100644 --- a/src/components/Advertisements/core/AdvertisementRegister/AdvertisementRegister.test.tsx +++ b/src/components/Advertisements/core/AdvertisementRegister/AdvertisementRegister.test.tsx @@ -249,7 +249,7 @@ describe('Testing Advertisement Register Component', () => { }); await waitFor(() => { - expect(toast.success).toBeCalledWith( + expect(toast.success).toHaveBeenCalledWith( 'Advertisement created successfully.', ); expect(setTimeoutSpy).toHaveBeenCalled(); @@ -340,7 +340,7 @@ describe('Testing Advertisement Register Component', () => { }); await waitFor(() => { - expect(toast.success).toBeCalledWith( + expect(toast.success).toHaveBeenCalledWith( 'Advertisement created successfully.', ); expect(setTimeoutSpy).toHaveBeenCalled(); @@ -465,7 +465,7 @@ describe('Testing Advertisement Register Component', () => { await waitFor(() => { fireEvent.click(getByText(translations.register)); }); - expect(toast.error).toBeCalledWith( + expect(toast.error).toHaveBeenCalledWith( 'End Date should be greater than or equal to Start Date', ); expect(setTimeoutSpy).toHaveBeenCalled(); @@ -592,7 +592,7 @@ describe('Testing Advertisement Register Component', () => { fireEvent.click(getByText(translations.saveChanges)); await waitFor(() => { - expect(toast.error).toBeCalledWith( + expect(toast.error).toHaveBeenCalledWith( 'End Date should be greater than or equal to Start Date', ); }); diff --git a/src/components/AgendaCategory/AgendaCategoryContainer.test.tsx b/src/components/AgendaCategory/AgendaCategoryContainer.test.tsx index 5ddab82aec..d8e27c3cb2 100644 --- a/src/components/AgendaCategory/AgendaCategoryContainer.test.tsx +++ b/src/components/AgendaCategory/AgendaCategoryContainer.test.tsx @@ -269,7 +269,9 @@ describe('Testing Agenda Category Component', () => { userEvent.click(screen.getByTestId('editAgendaCategoryBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.agendaCategoryUpdated); + expect(toast.success).toHaveBeenCalledWith( + translations.agendaCategoryUpdated, + ); }); }); @@ -362,7 +364,9 @@ describe('Testing Agenda Category Component', () => { userEvent.click(screen.getByTestId('deleteAgendaCategoryBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.agendaCategoryDeleted); + expect(toast.success).toHaveBeenCalledWith( + translations.agendaCategoryDeleted, + ); }); }); diff --git a/src/components/AgendaItems/AgendaItemsContainer.test.tsx b/src/components/AgendaItems/AgendaItemsContainer.test.tsx index 7ceb8b4d08..8b391a2073 100644 --- a/src/components/AgendaItems/AgendaItemsContainer.test.tsx +++ b/src/components/AgendaItems/AgendaItemsContainer.test.tsx @@ -371,7 +371,9 @@ describe('Testing Agenda Items components', () => { userEvent.click(screen.getByTestId('deleteAgendaItemBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.agendaItemDeleted); + expect(toast.success).toHaveBeenCalledWith( + translations.agendaItemDeleted, + ); }); }); diff --git a/src/components/EventListCard/EventListCard.test.tsx b/src/components/EventListCard/EventListCard.test.tsx index b882d5887b..afe81f436e 100644 --- a/src/components/EventListCard/EventListCard.test.tsx +++ b/src/components/EventListCard/EventListCard.test.tsx @@ -362,7 +362,7 @@ describe('Testing Event List Card', () => { userEvent.click(screen.getByTestId('updateEventBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.eventUpdated); + expect(toast.success).toHaveBeenCalledWith(translations.eventUpdated); }); await waitFor(() => { @@ -415,7 +415,7 @@ describe('Testing Event List Card', () => { userEvent.click(screen.getByTestId('updateEventBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.eventUpdated); + expect(toast.success).toHaveBeenCalledWith(translations.eventUpdated); }); await waitFor(() => { @@ -459,7 +459,7 @@ describe('Testing Event List Card', () => { userEvent.click(screen.getByTestId('updateEventBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.eventUpdated); + expect(toast.success).toHaveBeenCalledWith(translations.eventUpdated); }); await waitFor(() => { @@ -696,7 +696,7 @@ describe('Testing Event List Card', () => { }); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.eventUpdated); + expect(toast.success).toHaveBeenCalledWith(translations.eventUpdated); }); await waitFor(() => { @@ -762,7 +762,7 @@ describe('Testing Event List Card', () => { userEvent.click(screen.getByTestId('updateEventBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.eventUpdated); + expect(toast.success).toHaveBeenCalledWith(translations.eventUpdated); }); await waitFor(() => { @@ -823,7 +823,7 @@ describe('Testing Event List Card', () => { userEvent.click(screen.getByTestId('deleteEventBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.eventDeleted); + expect(toast.success).toHaveBeenCalledWith(translations.eventDeleted); }); await waitFor(() => { @@ -863,7 +863,7 @@ describe('Testing Event List Card', () => { userEvent.click(screen.getByTestId('deleteEventBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.eventDeleted); + expect(toast.success).toHaveBeenCalledWith(translations.eventDeleted); }); await waitFor(() => { @@ -921,7 +921,7 @@ describe('Testing Event List Card', () => { userEvent.click(screen.getByTestId('registerEventBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith( + expect(toast.success).toHaveBeenCalledWith( `Successfully registered for ${props[2].eventName}`, ); }); diff --git a/src/components/OrgSettings/AgendaItemCategories/OrganizationAgendaCategory.test.tsx b/src/components/OrgSettings/AgendaItemCategories/OrganizationAgendaCategory.test.tsx index e05edc665d..56cb450647 100644 --- a/src/components/OrgSettings/AgendaItemCategories/OrganizationAgendaCategory.test.tsx +++ b/src/components/OrgSettings/AgendaItemCategories/OrganizationAgendaCategory.test.tsx @@ -185,7 +185,9 @@ describe('Testing Agenda Categories Component', () => { userEvent.click(screen.getByTestId('createAgendaCategoryFormSubmitBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.agendaCategoryCreated); + expect(toast.success).toHaveBeenCalledWith( + translations.agendaCategoryCreated, + ); }); }); diff --git a/src/components/RecurrenceOptions/CustomRecurrence.test.tsx b/src/components/RecurrenceOptions/CustomRecurrence.test.tsx index f21553c5af..fc0cacf5c4 100644 --- a/src/components/RecurrenceOptions/CustomRecurrence.test.tsx +++ b/src/components/RecurrenceOptions/CustomRecurrence.test.tsx @@ -581,7 +581,7 @@ describe('Testing the creaction of recurring events with custom recurrence patte userEvent.click(screen.getByTestId('createEventBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.eventCreated); + expect(toast.success).toHaveBeenCalledWith(translations.eventCreated); }); await waitFor(() => { @@ -709,7 +709,7 @@ describe('Testing the creaction of recurring events with custom recurrence patte userEvent.click(screen.getByTestId('createEventBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.eventCreated); + expect(toast.success).toHaveBeenCalledWith(translations.eventCreated); }); await waitFor(() => { diff --git a/src/components/RecurrenceOptions/RecurrenceOptions.test.tsx b/src/components/RecurrenceOptions/RecurrenceOptions.test.tsx index 510f7a04aa..2d283460da 100644 --- a/src/components/RecurrenceOptions/RecurrenceOptions.test.tsx +++ b/src/components/RecurrenceOptions/RecurrenceOptions.test.tsx @@ -453,7 +453,7 @@ describe('Testing the creaction of recurring events through recurrence options', userEvent.click(screen.getByTestId('createEventBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.eventCreated); + expect(toast.success).toHaveBeenCalledWith(translations.eventCreated); }); await waitFor(() => { @@ -575,7 +575,7 @@ describe('Testing the creaction of recurring events through recurrence options', userEvent.click(screen.getByTestId('createEventBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.eventCreated); + expect(toast.success).toHaveBeenCalledWith(translations.eventCreated); }); await waitFor(() => { diff --git a/src/components/TableLoader/TableLoader.test.tsx b/src/components/TableLoader/TableLoader.test.tsx index e8400c84ef..a7d334a1c7 100644 --- a/src/components/TableLoader/TableLoader.test.tsx +++ b/src/components/TableLoader/TableLoader.test.tsx @@ -73,6 +73,6 @@ describe('Testing Loader component', () => { , ); - }).toThrowError(); + }).toThrow(); }); }); diff --git a/src/components/UserPortal/PostCard/PostCard.test.tsx b/src/components/UserPortal/PostCard/PostCard.test.tsx index f7d9217308..1b7708b384 100644 --- a/src/components/UserPortal/PostCard/PostCard.test.tsx +++ b/src/components/UserPortal/PostCard/PostCard.test.tsx @@ -338,7 +338,7 @@ describe('Testing PostCard Component [User Portal]', () => { userEvent.click(screen.getByTestId('editPostBtn')); await wait(); - expect(toast.success).toBeCalledWith('Post updated Successfully'); + expect(toast.success).toHaveBeenCalledWith('Post updated Successfully'); }); test('Delete post should work properly', async () => { @@ -388,7 +388,9 @@ describe('Testing PostCard Component [User Portal]', () => { userEvent.click(screen.getByTestId('deletePost')); await wait(); - expect(toast.success).toBeCalledWith('Successfully deleted the Post.'); + expect(toast.success).toHaveBeenCalledWith( + 'Successfully deleted the Post.', + ); }); test('Component should be rendered properly if user has liked the post', async () => { diff --git a/src/components/UserPortal/Register/Register.test.tsx b/src/components/UserPortal/Register/Register.test.tsx index f9929a0588..1883d60da3 100644 --- a/src/components/UserPortal/Register/Register.test.tsx +++ b/src/components/UserPortal/Register/Register.test.tsx @@ -104,7 +104,7 @@ describe('Testing Register Component [User Portal]', () => { userEvent.click(screen.getByTestId('setLoginBtn')); - expect(setCurrentMode).toBeCalledWith('login'); + expect(setCurrentMode).toHaveBeenCalledWith('login'); }); test('Expect toast.error to be called if email input is empty', async () => { @@ -124,7 +124,7 @@ describe('Testing Register Component [User Portal]', () => { userEvent.click(screen.getByTestId('registerBtn')); - expect(toast.error).toBeCalledWith('Please enter valid details.'); + expect(toast.error).toHaveBeenCalledWith('Please enter valid details.'); }); test('Expect toast.error to be called if password input is empty', async () => { @@ -145,7 +145,7 @@ describe('Testing Register Component [User Portal]', () => { userEvent.type(screen.getByTestId('emailInput'), formData.email); userEvent.click(screen.getByTestId('registerBtn')); - expect(toast.error).toBeCalledWith('Please enter valid details.'); + expect(toast.error).toHaveBeenCalledWith('Please enter valid details.'); }); test('Expect toast.error to be called if first name input is empty', async () => { @@ -169,7 +169,7 @@ describe('Testing Register Component [User Portal]', () => { userEvent.click(screen.getByTestId('registerBtn')); - expect(toast.error).toBeCalledWith('Please enter valid details.'); + expect(toast.error).toHaveBeenCalledWith('Please enter valid details.'); }); test('Expect toast.error to be called if last name input is empty', async () => { @@ -195,7 +195,7 @@ describe('Testing Register Component [User Portal]', () => { userEvent.click(screen.getByTestId('registerBtn')); - expect(toast.error).toBeCalledWith('Please enter valid details.'); + expect(toast.error).toHaveBeenCalledWith('Please enter valid details.'); }); test("Expect toast.error to be called if confirmPassword doesn't match with password", async () => { @@ -223,7 +223,7 @@ describe('Testing Register Component [User Portal]', () => { userEvent.click(screen.getByTestId('registerBtn')); - expect(toast.error).toBeCalledWith( + expect(toast.error).toHaveBeenCalledWith( "Password doesn't match. Confirm Password and try again.", ); }); @@ -260,7 +260,7 @@ describe('Testing Register Component [User Portal]', () => { await wait(); - expect(toast.success).toBeCalledWith( + expect(toast.success).toHaveBeenCalledWith( 'Successfully registered. Please wait for admin to approve your request.', ); }); diff --git a/src/components/UserPortal/StartPostModal/StartPostModal.test.tsx b/src/components/UserPortal/StartPostModal/StartPostModal.test.tsx index 5c436705cd..c34f3a2e9e 100644 --- a/src/components/UserPortal/StartPostModal/StartPostModal.test.tsx +++ b/src/components/UserPortal/StartPostModal/StartPostModal.test.tsx @@ -129,7 +129,9 @@ describe('Testing StartPostModal Component: User Portal', () => { await wait(); userEvent.click(screen.getByTestId('createPostBtn')); - expect(toastSpy).toBeCalledWith("Can't create a post with an empty body."); + expect(toastSpy).toHaveBeenCalledWith( + "Can't create a post with an empty body.", + ); }); test('On valid post submission Info toast should be shown', async () => { @@ -142,8 +144,10 @@ describe('Testing StartPostModal Component: User Portal', () => { userEvent.click(screen.getByTestId('createPostBtn')); - expect(toast.error).not.toBeCalledWith(); - expect(toast.info).toBeCalledWith('Processing your post. Please wait.'); + expect(toast.error).not.toHaveBeenCalledWith(); + expect(toast.info).toHaveBeenCalledWith( + 'Processing your post. Please wait.', + ); // await wait(); // expect(toast.success).toBeCalledWith( // 'Your post is now visible in the feed.', diff --git a/src/components/UsersTableItem/UserTableItem.test.tsx b/src/components/UsersTableItem/UserTableItem.test.tsx index e87b41f7f2..687165b78d 100644 --- a/src/components/UsersTableItem/UserTableItem.test.tsx +++ b/src/components/UsersTableItem/UserTableItem.test.tsx @@ -499,12 +499,12 @@ describe('Testing User Table Item', () => { fireEvent.click(searchBtn); // Click on Creator Link fireEvent.click(screen.getByTestId(`creatorabc`)); - expect(toast.success).toBeCalledWith('Profile Page Coming Soon !'); + expect(toast.success).toHaveBeenCalledWith('Profile Page Coming Soon !'); // Click on Organization Link fireEvent.click(screen.getByText(/Joined Organization 1/i)); - expect(window.location.replace).toBeCalledWith('/orgdash/abc'); - expect(mockNavgatePush).toBeCalledWith('/orgdash/abc'); + expect(window.location.replace).toHaveBeenCalledWith('/orgdash/abc'); + expect(mockNavgatePush).toHaveBeenCalledWith('/orgdash/abc'); fireEvent.click(screen.getByTestId(`closeJoinedOrgsBtn${123}`)); }); @@ -693,7 +693,7 @@ describe('Testing User Table Item', () => { expect(screen.getByTestId('removeUserFromOrgBtnmno')).toBeInTheDocument(); // Click on Creator Link fireEvent.click(screen.getByTestId(`creatorxyz`)); - expect(toast.success).toBeCalledWith('Profile Page Coming Soon !'); + expect(toast.success).toHaveBeenCalledWith('Profile Page Coming Soon !'); // Search for Blocked Organization 1 const searchBtn = screen.getByTestId(`searchBtnOrgsBlockedBy`); @@ -720,8 +720,8 @@ describe('Testing User Table Item', () => { // Click on Organization Link fireEvent.click(screen.getByText(/XYZ/i)); - expect(window.location.replace).toBeCalledWith('/orgdash/xyz'); - expect(mockNavgatePush).toBeCalledWith('/orgdash/xyz'); + expect(window.location.replace).toHaveBeenCalledWith('/orgdash/xyz'); + expect(mockNavgatePush).toHaveBeenCalledWith('/orgdash/xyz'); fireEvent.click(screen.getByTestId(`closeBlockedByOrgsBtn${123}`)); }); diff --git a/src/screens/ManageTag/ManageTag.test.tsx b/src/screens/ManageTag/ManageTag.test.tsx index 38ebba7402..e8324ca6d5 100644 --- a/src/screens/ManageTag/ManageTag.test.tsx +++ b/src/screens/ManageTag/ManageTag.test.tsx @@ -290,7 +290,9 @@ describe('Organisation Tags Page', () => { userEvent.click(screen.getByTestId('unassignTagModalSubmitBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.successfullyUnassigned); + expect(toast.success).toHaveBeenCalledWith( + translations.successfullyUnassigned, + ); }); }); }); diff --git a/src/screens/OrganizationDashboard/OrganizationDashboard.test.tsx b/src/screens/OrganizationDashboard/OrganizationDashboard.test.tsx index dde6b3120f..cf44fb3dbc 100644 --- a/src/screens/OrganizationDashboard/OrganizationDashboard.test.tsx +++ b/src/screens/OrganizationDashboard/OrganizationDashboard.test.tsx @@ -129,7 +129,7 @@ describe('Organisation Dashboard Page', () => { userEvent.click(viewEventsBtn); userEvent.click(viewPostsBtn); fireEvent.click(viewMSBtn); - expect(toast.success).toBeCalledWith('Coming soon!'); + expect(toast.success).toHaveBeenCalledWith('Coming soon!'); expect( screen.getByText(/No membership requests present/i), diff --git a/src/screens/OrganizationEvents/OrganizationEvents.test.tsx b/src/screens/OrganizationEvents/OrganizationEvents.test.tsx index 6c0491e2b2..09e896e031 100644 --- a/src/screens/OrganizationEvents/OrganizationEvents.test.tsx +++ b/src/screens/OrganizationEvents/OrganizationEvents.test.tsx @@ -282,7 +282,7 @@ describe('Organisation Events Page', () => { userEvent.click(screen.getByTestId('createEventBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.eventCreated); + expect(toast.success).toHaveBeenCalledWith(translations.eventCreated); }); await waitFor(() => { @@ -371,9 +371,9 @@ describe('Organisation Events Page', () => { expect(screen.getByTestId('registrableCheck')).toBeChecked(); userEvent.click(screen.getByTestId('createEventBtn')); - expect(toast.warning).toBeCalledWith('Title can not be blank!'); - expect(toast.warning).toBeCalledWith('Description can not be blank!'); - expect(toast.warning).toBeCalledWith('Location can not be blank!'); + expect(toast.warning).toHaveBeenCalledWith('Title can not be blank!'); + expect(toast.warning).toHaveBeenCalledWith('Description can not be blank!'); + expect(toast.warning).toHaveBeenCalledWith('Location can not be blank!'); userEvent.click(screen.getByTestId('createEventModalCloseBtn')); @@ -452,7 +452,7 @@ describe('Organisation Events Page', () => { userEvent.click(screen.getByTestId('createEventBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.eventCreated); + expect(toast.success).toHaveBeenCalledWith(translations.eventCreated); }); await waitFor(() => { diff --git a/src/screens/OrganizationTags/OrganizationTags.test.tsx b/src/screens/OrganizationTags/OrganizationTags.test.tsx index 923a26d982..2665f2907f 100644 --- a/src/screens/OrganizationTags/OrganizationTags.test.tsx +++ b/src/screens/OrganizationTags/OrganizationTags.test.tsx @@ -223,7 +223,9 @@ describe('Organisation Tags Page', () => { userEvent.click(screen.getByTestId('createTagSubmitBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.tagCreationSuccess); + expect(toast.success).toHaveBeenCalledWith( + translations.tagCreationSuccess, + ); }); }); @@ -240,7 +242,9 @@ describe('Organisation Tags Page', () => { userEvent.click(screen.getByTestId('removeUserTagSubmitBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.tagRemovalSuccess); + expect(toast.success).toHaveBeenCalledWith( + translations.tagRemovalSuccess, + ); }); }); }); diff --git a/src/screens/SubTags/SubTags.test.tsx b/src/screens/SubTags/SubTags.test.tsx index 1780027639..658c469011 100644 --- a/src/screens/SubTags/SubTags.test.tsx +++ b/src/screens/SubTags/SubTags.test.tsx @@ -302,7 +302,9 @@ describe('Organisation Tags Page', () => { userEvent.click(screen.getByTestId('addSubTagSubmitBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.tagCreationSuccess); + expect(toast.success).toHaveBeenCalledWith( + translations.tagCreationSuccess, + ); }); }); @@ -319,7 +321,9 @@ describe('Organisation Tags Page', () => { userEvent.click(screen.getByTestId('removeUserTagSubmitBtn')); await waitFor(() => { - expect(toast.success).toBeCalledWith(translations.tagRemovalSuccess); + expect(toast.success).toHaveBeenCalledWith( + translations.tagRemovalSuccess, + ); }); }); }); diff --git a/src/screens/UserPortal/Events/Events.test.tsx b/src/screens/UserPortal/Events/Events.test.tsx index e5ef6d2b03..8c0b7c6912 100644 --- a/src/screens/UserPortal/Events/Events.test.tsx +++ b/src/screens/UserPortal/Events/Events.test.tsx @@ -336,7 +336,7 @@ describe('Testing Events Screen [User Portal]', () => { await wait(); - expect(toast.success).toBeCalledWith( + expect(toast.success).toHaveBeenCalledWith( 'Event created and posted successfully.', ); }); @@ -379,7 +379,7 @@ describe('Testing Events Screen [User Portal]', () => { await wait(); - expect(toast.success).toBeCalledWith( + expect(toast.success).toHaveBeenCalledWith( 'Event created and posted successfully.', ); });