blob: ce6a6ba051f44cc09bb723fee20c02584ca9d3ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import '@testing-library/jest-dom';
import React from 'react';
import { describe, expect, it } from 'vitest';
import { createMemoryRouter, RouterProvider } from 'react-router-dom';
import { renderWithProviders } from '../renderWithProviders';
import routes from '../routes';
import { showSnackbar } from '../slices/uiSlice';
import setupStore from '../store';
describe('Global Snackbar', async () => {
const memoryRouter = createMemoryRouter(routes, {
initialEntries: ['/'],
});
it('displays message', async () => {
const store = setupStore();
store.dispatch(
showSnackbar({
message: 'message',
severity: 'success',
})
);
const { findByText } = renderWithProviders(
<RouterProvider router={memoryRouter} />,
{ store }
);
expect(await findByText(/message/i)).toBeInTheDocument();
});
});
|