Skip to content

Commit 4961964

Browse files
author
Sebastian Silbermann
committed
Update expectations of new tests
1 parent 37b4238 commit 4961964

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

Diff for: src/__tests__/end-to-end.js

+5-15
Original file line numberDiff line numberDiff line change
@@ -202,26 +202,16 @@ describe.each([
202202
)
203203
}
204204

205-
test('waitForElementToBeRemoved', async () => {
206-
render(<ComponentWithMicrotaskLoader />)
207-
const loading = () => screen.getByText('Loading..')
208-
await waitForElementToBeRemoved(loading)
209-
expect(screen.getByTestId('message')).toHaveTextContent(/Hello World/)
210-
})
211-
212205
test('waitFor', async () => {
213-
render(<ComponentWithMicrotaskLoader />)
214-
await waitFor(() => {
215-
screen.getByText('Loading..')
216-
})
217-
await waitFor(() => {
218-
screen.getByText(/Loaded this message:/)
219-
})
206+
await render(<ComponentWithMicrotaskLoader />)
207+
// Already flushed microtasks from `ComponentWithMicrotaskLoader` here.
208+
expect(screen.queryByText('Loading..')).not.toBeInTheDocument()
209+
expect(screen.getByText(/Loaded this message:/)).toBeInTheDocument()
220210
expect(screen.getByTestId('message')).toHaveTextContent(/Hello World/)
221211
})
222212

223213
test('findBy', async () => {
224-
render(<ComponentWithMicrotaskLoader />)
214+
await render(<ComponentWithMicrotaskLoader />)
225215
await expect(screen.findByTestId('message')).resolves.toHaveTextContent(
226216
/Hello World/,
227217
)

0 commit comments

Comments
 (0)