Skip to content

Commit

Permalink
test clear of donate
Browse files Browse the repository at this point in the history
  • Loading branch information
AnshulKahar2729 committed Aug 22, 2024
1 parent ffb43d1 commit cb1219b
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions src/screens/UserPortal/Donate/Donate.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ const MOCKS = [
},
];


const link = new StaticMockLink(MOCKS, true);

async function wait(ms = 100): Promise<void> {
Expand All @@ -138,22 +139,6 @@ jest.mock('react-router-dom', () => ({
useParams: () => ({ orgId: '' }),
}));

jest.mock('react-i18next', () => ({
// This mock makes sure any components using the translate hook can use it without a warning being shown
useTranslation: () => {
return {
t: (str: string) => str,
i18n: {
changeLanguage: () =>
new Promise(() => {
// This is an intentionally empty function
// It's used to mock the changeLanguage method without actually doing anything
}),
},
};
},
}));

jest.mock('react-toastify', () => ({
toast: {
error: jest.fn(),
Expand Down Expand Up @@ -325,7 +310,7 @@ describe('Testing Donate Screen [User Portal]', () => {

await wait();

expect(toast.error).toHaveBeenCalledWith('invalidAmount');
expect(toast.error).toHaveBeenCalledWith("Please enter a numerical value for the donation amount.");
});

test('displays error toast for invalid (non-numeric) donation amount', async () => {
Expand All @@ -348,6 +333,6 @@ describe('Testing Donate Screen [User Portal]', () => {

await wait();

expect(toast.error).toHaveBeenCalledWith('invalidAmount');
expect(toast.error).toHaveBeenCalledWith("Please enter a numerical value for the donation amount.");
});
});

0 comments on commit cb1219b

Please sign in to comment.