diff options
author | Michael Hunteman <michael@huntm.net> | 2024-09-27 08:43:02 -0700 |
---|---|---|
committer | Michael Hunteman <michael@huntm.net> | 2024-09-27 08:43:02 -0700 |
commit | a88f613da7e5567dbfdebd7df94f94507c47c6b5 (patch) | |
tree | b10a6c1640c11672a940f8fa71cdf3d3485135d4 /client/src/components/GlobalSnackbar.test.tsx | |
parent | 7ccca5ca18200388d10fca33a1d7095a0abfcd36 (diff) |
Add vitests
Diffstat (limited to 'client/src/components/GlobalSnackbar.test.tsx')
-rw-r--r-- | client/src/components/GlobalSnackbar.test.tsx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/client/src/components/GlobalSnackbar.test.tsx b/client/src/components/GlobalSnackbar.test.tsx new file mode 100644 index 0000000..2643816 --- /dev/null +++ b/client/src/components/GlobalSnackbar.test.tsx @@ -0,0 +1,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/snackbarSlice'; +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(); + }); +}); |