@@ -11,8 +11,7 @@ test('Review form submits', async () => {
11
11
const fakeReview = {
12
12
title : 'An Awesome Movie' ,
13
13
review : 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.' ,
14
- rating : '3' ,
15
- recommend : true
14
+ rating : '3'
16
15
}
17
16
18
17
const {
@@ -46,7 +45,7 @@ test('Review form submits', async () => {
46
45
expect ( ratingSelect . checked ) . toBe ( true )
47
46
expect ( initiallySelectedInput . checked ) . toBe ( false )
48
47
49
- // Get the Input element by its implicit ARIA role.
48
+ // Get the Input element by its implicit ARIA role
50
49
const recommendInput = getByRole ( 'checkbox' )
51
50
52
51
expect ( recommendInput . checked ) . toBe ( false )
@@ -56,13 +55,13 @@ test('Review form submits', async () => {
56
55
// NOTE: in jsdom, it's not possible to trigger a form submission
57
56
// by clicking on the submit button. This is really unfortunate.
58
57
// So the next best thing is to fireEvent a submit on the form itself
59
- // then ensure that there's a submit button.
58
+ // then ensure that there's a submit button
60
59
expect ( submitButton ) . toBeEnabled ( )
61
60
expect ( submitButton ) . toHaveAttribute ( 'type' , 'submit' )
62
61
63
62
await fireEvent . click ( submitButton )
64
63
65
- // Assert event has been emitted.
66
- expect ( emitted ( ) . submit ) . toHaveLength ( 1 )
67
- expect ( emitted ( ) . submit [ 0 ] ) . toEqual ( [ fakeReview ] )
64
+ // Assert event has been emitted
65
+ expect ( emitted ( ) ) . toHaveProperty ( 'submit' )
66
+ expect ( emitted ( ) . submit [ 0 ] [ 0 ] ) . toMatchObject ( fakeReview )
68
67
} )
0 commit comments