mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-19 03:01:53 +10:00
Builder and Dashboard unit tests: fine tuning of assertions related to toast/notification
This commit is contained in:
@ -2,6 +2,7 @@ import { navigate as mockNavigateFunction } from 'gatsby';
|
||||
import React from 'react';
|
||||
import {
|
||||
fireEvent,
|
||||
getByText,
|
||||
render,
|
||||
screen,
|
||||
waitFor,
|
||||
@ -117,9 +118,13 @@ describe('Builder', () => {
|
||||
);
|
||||
expect(mockNavigateFunction).toHaveBeenCalledWith('/app/dashboard');
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByRole('alert')).toBeInTheDocument();
|
||||
});
|
||||
const notification = await screen.findByRole('alert');
|
||||
expect(
|
||||
getByText(
|
||||
notification,
|
||||
/The resume you were looking for does not exist anymore/i,
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
|
||||
await waitFor(() =>
|
||||
expect(
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
fireEvent,
|
||||
getByText,
|
||||
queryByText,
|
||||
render,
|
||||
screen,
|
||||
@ -160,9 +161,13 @@ describe('Dashboard', () => {
|
||||
});
|
||||
|
||||
it('displays notification', async () => {
|
||||
await waitFor(() => {
|
||||
expect(screen.getByRole('alert')).toBeInTheDocument();
|
||||
});
|
||||
const notification = await screen.findByRole('alert');
|
||||
expect(
|
||||
getByText(
|
||||
notification,
|
||||
new RegExp(`${resumeToDelete.name} was deleted successfully`, 'i'),
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
|
||||
await waitForDatabaseRemoveToHaveCompleted();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user