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 React from 'react';
|
||||||
import {
|
import {
|
||||||
fireEvent,
|
fireEvent,
|
||||||
|
getByText,
|
||||||
render,
|
render,
|
||||||
screen,
|
screen,
|
||||||
waitFor,
|
waitFor,
|
||||||
@ -117,9 +118,13 @@ describe('Builder', () => {
|
|||||||
);
|
);
|
||||||
expect(mockNavigateFunction).toHaveBeenCalledWith('/app/dashboard');
|
expect(mockNavigateFunction).toHaveBeenCalledWith('/app/dashboard');
|
||||||
|
|
||||||
await waitFor(() => {
|
const notification = await screen.findByRole('alert');
|
||||||
expect(screen.getByRole('alert')).toBeInTheDocument();
|
expect(
|
||||||
});
|
getByText(
|
||||||
|
notification,
|
||||||
|
/The resume you were looking for does not exist anymore/i,
|
||||||
|
),
|
||||||
|
).toBeInTheDocument();
|
||||||
|
|
||||||
await waitFor(() =>
|
await waitFor(() =>
|
||||||
expect(
|
expect(
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {
|
import {
|
||||||
fireEvent,
|
fireEvent,
|
||||||
|
getByText,
|
||||||
queryByText,
|
queryByText,
|
||||||
render,
|
render,
|
||||||
screen,
|
screen,
|
||||||
@ -160,9 +161,13 @@ describe('Dashboard', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('displays notification', async () => {
|
it('displays notification', async () => {
|
||||||
await waitFor(() => {
|
const notification = await screen.findByRole('alert');
|
||||||
expect(screen.getByRole('alert')).toBeInTheDocument();
|
expect(
|
||||||
});
|
getByText(
|
||||||
|
notification,
|
||||||
|
new RegExp(`${resumeToDelete.name} was deleted successfully`, 'i'),
|
||||||
|
),
|
||||||
|
).toBeInTheDocument();
|
||||||
|
|
||||||
await waitForDatabaseRemoveToHaveCompleted();
|
await waitForDatabaseRemoveToHaveCompleted();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user