Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgraded testing-lib/user-event to 14.5.2 #2266

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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',
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
});
});

Expand Down Expand Up @@ -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,
);
});
});

Expand Down
4 changes: 3 additions & 1 deletion src/components/AgendaItems/AgendaItemsContainer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
});
});

Expand Down
16 changes: 8 additions & 8 deletions src/components/EventListCard/EventListCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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}`,
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
});
});

Expand Down
4 changes: 2 additions & 2 deletions src/components/RecurrenceOptions/CustomRecurrence.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/RecurrenceOptions/RecurrenceOptions.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/TableLoader/TableLoader.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ describe('Testing Loader component', () => {
<TableLoader {...props} />
</BrowserRouter>,
);
}).toThrowError();
}).toThrow();
});
});
6 changes: 4 additions & 2 deletions src/components/UserPortal/PostCard/PostCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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 () => {
Expand Down
14 changes: 7 additions & 7 deletions src/components/UserPortal/Register/Register.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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 () => {
Expand All @@ -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 () => {
Expand All @@ -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 () => {
Expand All @@ -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 () => {
Expand Down Expand Up @@ -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.",
);
});
Expand Down Expand Up @@ -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.',
);
});
Expand Down
10 changes: 7 additions & 3 deletions src/components/UserPortal/StartPostModal/StartPostModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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.',
Expand Down
Loading
Loading