Skip to content

Commit

Permalink
ensure jest-dom matchers included in types
Browse files Browse the repository at this point in the history
  • Loading branch information
EskiMojo14 committed Jan 12, 2024
1 parent fca9009 commit 1cf40fa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/usage/WritingTests.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ interface ExtendedRenderOptions extends Omit<RenderOptions, 'queries'> {

export function renderWithProviders(
ui: React.ReactElement,
extendedRenderOptions: ExtendedRenderOptions = {},
extendedRenderOptions: ExtendedRenderOptions = {}
) {
const {
preloadedState = {},
Expand All @@ -367,7 +367,7 @@ export function renderWithProviders(
// Return an object with the store and all of RTL's query functions
return {
store,
...render(ui, { wrapper: Wrapper, ...renderOptions }),
...render(ui, { wrapper: Wrapper, ...renderOptions })
}
}
```
Expand Down Expand Up @@ -478,6 +478,9 @@ export function renderWithProviders(
The actual test files should use the custom `render` function to actually render our Redux-connected components. If the code that we're testing involves making network requests, we should also configure MSW to mock the expected requests with appropriate test data.

```tsx title="features/users/tests/UserDisplay.test.tsx"
// file: jest-setup.ts noEmit
import '@testing-library/jest-dom'

// file: features/users/userSlice.ts noEmit
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit'
import type { RootState } from '../../app/store'
Expand Down

0 comments on commit 1cf40fa

Please sign in to comment.