Skip to content

Commit

Permalink
use waitFor
Browse files Browse the repository at this point in the history
  • Loading branch information
kaznak committed Feb 7, 2021
1 parent 2417167 commit 57b2007
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/pages/counter.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { screen, render, fireEvent, act } from '@testing-library/react'
import { screen, render, fireEvent, act, waitFor } from '@testing-library/react'
import { Counter } from '../../pages/counter'

describe('Counter', () => {
Expand All @@ -13,6 +13,6 @@ describe('Counter', () => {
await act(async () => {
fireEvent.click(screen.getByText('+', { selector: 'button' }))
})
expect(screen.getByText('1', { selector: 'p' }))
await waitFor(() => expect(screen.getByText('1', { selector: 'p' })))
})
})

0 comments on commit 57b2007

Please sign in to comment.