@@ -48,8 +48,8 @@ test('happy path works', async () => {
4848 expect ( resetButton ) . toHaveAttribute ( 'disabled' )
4949
5050 const testData = { ...mockUser , tagline : 'test tagline' , bio : 'test bio' }
51- userEvent . type ( taglineInput , testData . tagline )
52- userEvent . type ( bioInput , testData . bio )
51+ await userEvent . type ( taglineInput , testData . tagline )
52+ await userEvent . type ( bioInput , testData . bio )
5353
5454 // changed form enables submit and reset
5555 expect ( submitButton ) . toHaveTextContent ( / s u b m i t / i)
@@ -61,7 +61,7 @@ test('happy path works', async () => {
6161 Promise . resolve ( updatedUser ) ,
6262 )
6363
64- userEvent . click ( submitButton )
64+ await userEvent . click ( submitButton )
6565
6666 // pending form sets the submit button to ... and disables the submit and reset buttons
6767 expect ( submitButton ) . toHaveTextContent ( / \. \. \. / i)
@@ -88,11 +88,11 @@ test('happy path works', async () => {
8888 expect ( getDisplayData ( ) ) . toEqual ( updatedUser )
8989} )
9090
91- test ( 'reset works' , ( ) => {
91+ test ( 'reset works' , async ( ) => {
9292 const { resetButton, taglineInput} = renderApp ( )
9393
94- userEvent . type ( taglineInput , 'foo' )
95- userEvent . click ( resetButton )
94+ await userEvent . type ( taglineInput , 'foo' )
95+ await userEvent . click ( resetButton )
9696 expect ( taglineInput . value ) . toBe ( mockUser . tagline )
9797} )
9898
@@ -107,15 +107,15 @@ test('failure works', async () => {
107107 } = renderApp ( )
108108
109109 const testData = { ...mockUser , bio : 'test bio' }
110- userEvent . type ( bioInput , testData . bio )
110+ await userEvent . type ( bioInput , testData . bio )
111111 const testErrorMessage = 'test error message'
112112 userClient . updateUser . mockImplementationOnce ( ( ) =>
113113 Promise . reject ( { message : testErrorMessage } ) ,
114114 )
115115
116116 const updatedUser = { ...mockUser , ...testData }
117117
118- userEvent . click ( submitButton )
118+ await userEvent . click ( submitButton )
119119
120120 await waitForLoading ( )
121121
@@ -128,7 +128,7 @@ test('failure works', async () => {
128128 userClient . updateUser . mockImplementationOnce ( ( ) =>
129129 Promise . resolve ( updatedUser ) ,
130130 )
131- userEvent . click ( submitButton )
131+ await userEvent . click ( submitButton )
132132
133133 await waitForLoading ( )
134134
0 commit comments