Skip to content

Commit 0511fed

Browse files
author
Kent C. Dodds
committed
chore: cleanup deprecated assertions
Closes #140
1 parent a0022cf commit 0511fed

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,9 @@ test('can fill in the form after loaded', async () => {
561561

562562
// wait until the callback does not throw an error. In this case, that means
563563
// it'll wait until the element with the text that says "loading..." is gone.
564-
await wait(() => expect(queryByText(/loading\.\.\./i).not.toBeInTheDOM()))
564+
await wait(() =>
565+
expect(queryByText(/loading\.\.\./i).not.toBeInTheDocument()),
566+
)
565567
getByLabelText('username').value = 'chucknorris'
566568
// continue doing stuff
567569
})
@@ -658,7 +660,7 @@ import {render} from 'react-testing-library'
658660
const {queryAllByText} = render(<Forms />)
659661
const submitButtons = queryAllByText('submit')
660662
expect(submitButtons).toHaveLength(3) // expect 3 elements
661-
expect(submitButtons[0]).toBeInTheDOM()
663+
expect(submitButtons[0]).toBeInTheDocument()
662664
```
663665
664666
## Examples

src/__tests__/render.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ test('works great with react portals', () => {
4343
}
4444

4545
const {unmount, getByTestId, getByText} = render(<MyPortal />)
46-
expect(getByText('Hello World')).toBeInTheDOM()
46+
expect(getByText('Hello World')).toBeInTheDocument()
4747
const portalNode = getByTestId('my-portal')
48-
expect(document.body.contains(portalNode)).toBe(true)
48+
expect(portalNode).toBeInTheDocument()
4949
unmount()
50-
expect(document.body.contains(portalNode)).toBe(false)
50+
expect(portalNode).not.toBeInTheDocument()
5151
})
5252

5353
test('returns baseElement which defaults to document.body', () => {

0 commit comments

Comments
 (0)