Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pranshugupta54 committed Jul 6, 2024
1 parent d474051 commit adc106a
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe('Testing AddOnRegister', () => {
userEvent.click(screen.getByTestId('addonregisterBtn'));

await wait(100);
expect(toast.success).toBeCalledWith('Plugin Added Successfully');
expect(toast.success).toBeCalledWith('Plugin added Successfully');
});
});

Expand Down
2 changes: 1 addition & 1 deletion src/components/Advertisements/Advertisements.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ describe('Testing Advertisement Component', () => {

userEvent.click(screen.getByTestId('addonregister'));
expect(
await screen.findByText('Advertisement created successfully'),
await screen.findByText('Advertisement created successfully.'),
).toBeInTheDocument();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ describe('Testing Advertisement Register Component', () => {
await waitFor(() => {
fireEvent.click(getByText(translations.register));
});
expect(toast.success).toBeCalledWith('Advertisement created successfully');
expect(toast.success).toBeCalledWith('Advertisement created successfully.');
expect(setTimeoutSpy).toHaveBeenCalled();
});

Expand Down Expand Up @@ -295,7 +295,7 @@ describe('Testing Advertisement Register Component', () => {
await waitFor(() => {
fireEvent.click(getByText(translations.saveChanges));
});
expect(toast.success).toBeCalledWith('Advertisement created successfully');
expect(toast.success).toBeCalledWith('Advertisement created successfully.');
expect(setTimeoutSpy).toHaveBeenCalled();
});

Expand Down Expand Up @@ -330,7 +330,7 @@ describe('Testing Advertisement Register Component', () => {
fireEvent.click(getByText(translations.register));
});
expect(toast.error).toBeCalledWith(
'An error occured, could not create new advertisement',
`An error occurred. Couldn't create advertisement`,
);
expect(setTimeoutSpy).toHaveBeenCalled();
});
Expand Down Expand Up @@ -400,7 +400,7 @@ describe('Testing Advertisement Register Component', () => {
fireEvent.click(getByText(translations.register));
});
expect(toast.error).toBeCalledWith(
'End date must be greater than or equal to start date',
'End Date should be greater than or equal to Start Date',
);
expect(setTimeoutSpy).toHaveBeenCalled();
});
Expand Down Expand Up @@ -521,7 +521,7 @@ describe('Testing Advertisement Register Component', () => {
fireEvent.click(getByText(translations.saveChanges));
await waitFor(() => {
expect(toast.error).toBeCalledWith(
'End date must be greater than or equal to start date',
'End Date should be greater than or equal to Start Date',
);
});
});
Expand Down
6 changes: 2 additions & 4 deletions src/components/CheckIn/TableRow.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Testing Table Row for CheckIn Table', () => {
fireEvent.click(queryByText('Check In') as Element);

await waitFor(() =>
expect(queryByText('Checked in successfully!')).toBeInTheDocument(),
expect(queryByText('Checked in successfully')).toBeInTheDocument(),
);
});

Expand Down Expand Up @@ -130,9 +130,7 @@ describe('Testing Table Row for CheckIn Table', () => {
fireEvent.click(queryByText('Check In') as Element);

await waitFor(() =>
expect(
queryByText('There was an error in checking in!'),
).toBeInTheDocument(),
expect(queryByText('Error checking in')).toBeInTheDocument(),
);
await waitFor(() => expect(queryByText('Oops')).toBeInTheDocument());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,7 @@ describe('Testing Event Registrants Modal', () => {
);

await waitFor(() =>
expect(
queryByText('Added the attendee successfully!'),
).toBeInTheDocument(),
expect(queryByText('Attendee added Successfully')).toBeInTheDocument(),
);
});

Expand Down Expand Up @@ -244,9 +242,7 @@ describe('Testing Event Registrants Modal', () => {
);

await waitFor(() =>
expect(
queryByText('There was an error in adding the attendee!'),
).toBeInTheDocument(),
expect(queryByText('Error adding attendee')).toBeInTheDocument(),
);
});

Expand Down Expand Up @@ -286,9 +282,7 @@ describe('Testing Event Registrants Modal', () => {
);

await waitFor(() =>
expect(
queryByText('Removed the attendee successfully!'),
).toBeInTheDocument(),
expect(queryByText('Attendee removed Successfully')).toBeInTheDocument(),
);
});

Expand Down Expand Up @@ -328,9 +322,7 @@ describe('Testing Event Registrants Modal', () => {
);

await waitFor(() =>
expect(
queryByText('There was an error in removing the attendee!'),
).toBeInTheDocument(),
expect(queryByText('Error removing attendee')).toBeInTheDocument(),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ describe('Testing User Password Update', () => {
userEvent.click(screen.getByText(/Save Changes/i));

await wait();
expect(mockToast.error).toHaveBeenCalledWith(
'The password field cannot be empty.',
);
expect(mockToast.error).toHaveBeenCalledWith(`Password can't be empty`);
});

test('displays an error when new and confirm password field does not match', async () => {
Expand Down
2 changes: 1 addition & 1 deletion 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('Successfully edited the Post.');
expect(toast.success).toBeCalledWith('Post updated Successfully');
});

test('Delete post should work properly', async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/UserPortal/PostCard/PostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export default function postCard(props: InterfacePostCard): JSX.Element {
});

props.fetchPosts();
toast.success(tCommon('deletedSuccessfully', { item: 'Post' }));
toast.success('Successfully deleted the Post.');
} catch (error: unknown) {
/* istanbul ignore next */
errorHandler(t, error);
Expand Down

0 comments on commit adc106a

Please sign in to comment.