Skip to content

Commit a92fa74

Browse files
authored
test: remove await from userEvent usage
1 parent 4376e64 commit a92fa74

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/__tests__/user-event.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ afterEach(() => {
1212
console.warn.mockRestore()
1313
})
1414

15-
test('User events in a form', async () => {
15+
test('User events in a form', () => {
1616
const fakeReview = {
1717
title: 'An Awesome Movie',
1818
review: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
@@ -24,49 +24,49 @@ test('User events in a form', async () => {
2424
expect(submitButton).toBeDisabled()
2525

2626
const titleInput = getByLabelText(/title of the movie/i)
27-
await userEvent.type(titleInput, fakeReview.title)
27+
userEvent.type(titleInput, fakeReview.title)
2828
expect(titleInput.value).toEqual(fakeReview.title)
2929

3030
const textArea = getByLabelText(/Your review/i)
31-
await userEvent.type(textArea, 'The t-rex went insane!')
31+
userEvent.type(textArea, 'The t-rex went insane!')
3232
expect(textArea.value).toEqual('The t-rex went insane!')
3333

34-
await userEvent.clear(textArea)
34+
userEvent.clear(textArea)
3535
expect(textArea.value).toEqual('')
36-
await userEvent.type(textArea, fakeReview.review)
36+
userEvent.type(textArea, fakeReview.review)
3737
expect(textArea.value).toEqual(fakeReview.review)
3838

3939
const initialSelectedRating = getByLabelText(/Awful/i)
4040
const wonderfulRadioInput = getByLabelText(/Wonderful/i)
4141
expect(initialSelectedRating).toBeChecked()
4242
expect(wonderfulRadioInput).not.toBeChecked()
4343

44-
await userEvent.click(wonderfulRadioInput)
44+
userEvent.click(wonderfulRadioInput)
4545
expect(wonderfulRadioInput).toBeChecked()
4646
expect(initialSelectedRating).not.toBeChecked()
4747

4848
const recommendInput = getByLabelText(/Would you recommend this movie?/i)
49-
await userEvent.click(recommendInput)
49+
userEvent.click(recommendInput)
5050
expect(recommendInput).toBeChecked()
5151

5252
userEvent.tab()
5353
expect(submitButton).toHaveFocus()
5454
expect(submitButton).toBeEnabled()
55-
await userEvent.type(submitButton, '{enter}')
55+
userEvent.type(submitButton, '{enter}')
5656
expect(emitted().submit[0][0]).toMatchObject(fakeReview)
5757

5858
expect(console.warn).not.toHaveBeenCalled()
5959
})
6060

61-
test('selecting option with user events', async () => {
61+
test('selecting option with user events', () => {
6262
const {getByDisplayValue} = render(Select)
6363
const select = getByDisplayValue('Tyrannosaurus')
6464
expect(select.value).toBe('dino1')
6565

66-
await userEvent.selectOptions(select, 'dino2')
66+
userEvent.selectOptions(select, 'dino2')
6767
expect(select.value).toBe('dino2')
6868

69-
await userEvent.selectOptions(select, 'dino3')
69+
userEvent.selectOptions(select, 'dino3')
7070
expect(select.value).not.toBe('dino2')
7171
expect(select.value).toBe('dino3')
7272
})

0 commit comments

Comments
 (0)