@@ -14,7 +14,7 @@ const formData = () => ({
14
14
'activity-type' : [ 'training' ] ,
15
15
duration : '1' ,
16
16
'end-date' : moment ( ) ,
17
- grantees : 'Grantee Name 1' ,
17
+ grantees : [ 'Grantee Name 1' ] ,
18
18
'number-of-participants' : '1' ,
19
19
'participant-category' : 'grantee' ,
20
20
participants : [ 'CEO / CFO / Executive' ] ,
@@ -31,33 +31,33 @@ describe('ActivityReport', () => {
31
31
describe ( 'changes the participant selection to' , ( ) => {
32
32
it ( 'Grantee' , async ( ) => {
33
33
render ( < ActivityReport /> ) ;
34
- const information = await waitFor ( ( ) => screen . getByRole ( 'group' , { name : 'Who was the activity for?' } ) ) ;
34
+ const information = await screen . findByRole ( 'group' , { name : 'Who was the activity for?' } ) ;
35
35
const grantee = within ( information ) . getByLabelText ( 'Grantee' ) ;
36
36
fireEvent . click ( grantee ) ;
37
- const granteeSelectbox = await waitFor ( ( ) => screen . getByRole ( 'textbox' , { name : 'Grantee name(s)' } ) ) ;
37
+ const granteeSelectbox = await screen . findByRole ( 'textbox' , { name : 'Grantee name(s)' } ) ;
38
38
reactSelectEvent . openMenu ( granteeSelectbox ) ;
39
- expect ( await waitFor ( ( ) => screen . getByText ( withText ( 'Grantee Name 1' ) ) ) ) . toBeVisible ( ) ;
39
+ expect ( await screen . findByText ( withText ( 'Grantee Name 1' ) ) ) . toBeVisible ( ) ;
40
40
} ) ;
41
41
42
42
it ( 'Non-grantee' , async ( ) => {
43
43
render ( < ActivityReport /> ) ;
44
- const information = await waitFor ( ( ) => screen . getByRole ( 'group' , { name : 'Who was the activity for?' } ) ) ;
44
+ const information = await screen . findByRole ( 'group' , { name : 'Who was the activity for?' } ) ;
45
45
const nonGrantee = within ( information ) . getByLabelText ( 'Non-Grantee' ) ;
46
46
fireEvent . click ( nonGrantee ) ;
47
- const granteeSelectbox = await waitFor ( ( ) => screen . getByRole ( 'textbox' , { name : 'Grantee name(s)' } ) ) ;
47
+ const granteeSelectbox = await screen . findByRole ( 'textbox' , { name : 'Grantee name(s)' } ) ;
48
48
reactSelectEvent . openMenu ( granteeSelectbox ) ;
49
- expect ( await waitFor ( ( ) => screen . getByText ( withText ( 'QRIS System' ) ) ) ) . toBeVisible ( ) ;
49
+ expect ( await screen . findByText ( withText ( 'QRIS System' ) ) ) . toBeVisible ( ) ;
50
50
} ) ;
51
51
} ) ;
52
52
53
53
it ( 'when non-grantee is selected' , async ( ) => {
54
54
render ( < ActivityReport /> ) ;
55
55
const enabled = screen . getByRole ( 'textbox' , { name : 'Grantee name(s)' } ) ;
56
56
expect ( enabled ) . toBeDisabled ( ) ;
57
- const information = await waitFor ( ( ) => screen . getByRole ( 'group' , { name : 'Who was the activity for?' } ) ) ;
57
+ const information = await screen . findByRole ( 'group' , { name : 'Who was the activity for?' } ) ;
58
58
const grantee = within ( information ) . getByLabelText ( 'Grantee' ) ;
59
59
fireEvent . click ( grantee ) ;
60
- const disabled = await waitFor ( ( ) => screen . getByRole ( 'textbox' , { name : 'Grantee name(s)' } ) ) ;
60
+ const disabled = await screen . findByRole ( 'textbox' , { name : 'Grantee name(s)' } ) ;
61
61
expect ( disabled ) . not . toBeDisabled ( ) ;
62
62
} ) ;
63
63
} ) ;
@@ -68,8 +68,8 @@ describe('ActivityReport', () => {
68
68
delete data [ 'activity-method' ] ;
69
69
70
70
render ( < ActivityReport initialData = { data } /> ) ;
71
- expect ( await waitFor ( ( ) => screen . getByText ( 'Continue' ) ) ) . toBeDisabled ( ) ;
72
- const box = await waitFor ( ( ) => screen . getByLabelText ( 'Virtual' ) ) ;
71
+ expect ( await screen . findByText ( 'Continue' ) ) . toBeDisabled ( ) ;
72
+ const box = await screen . findByLabelText ( 'Virtual' ) ;
73
73
fireEvent . click ( box ) ;
74
74
await waitFor ( ( ) => expect ( screen . getByText ( 'Continue' ) ) . not . toBeDisabled ( ) ) ;
75
75
} ) ;
@@ -81,8 +81,8 @@ describe('ActivityReport', () => {
81
81
delete data [ 'activity-type' ] ;
82
82
83
83
render ( < ActivityReport initialData = { data } /> ) ;
84
- expect ( await waitFor ( ( ) => screen . getByText ( 'Continue' ) ) ) . toBeDisabled ( ) ;
85
- const box = await waitFor ( ( ) => screen . getByLabelText ( 'Training' ) ) ;
84
+ expect ( await screen . findByText ( 'Continue' ) ) . toBeDisabled ( ) ;
85
+ const box = await screen . findByLabelText ( 'Training' ) ;
86
86
fireEvent . click ( box ) ;
87
87
await waitFor ( ( ) => expect ( screen . getByText ( 'Continue' ) ) . not . toBeDisabled ( ) ) ;
88
88
} ) ;
0 commit comments