File tree Expand file tree Collapse file tree 2 files changed +5
-13
lines changed Expand file tree Collapse file tree 2 files changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ beforeEach(() => {
9
9
} )
10
10
cy . intercept ( 'GET' , `${ mockServerURL } /employers` , {
11
11
fixture : 'employers.json'
12
- } ) . as ( 'getEmployers' )
12
+ } )
13
13
cy . visit ( '/' )
14
14
} )
15
15
@@ -125,21 +125,13 @@ it('requires employee selection', () => {
125
125
cy . findByRole ( 'button' , { name : / s u b m i t / i } ) . click ( )
126
126
cy . findByText ( / f o r m i s i n c o m p l e t e / i) . should ( 'exist' )
127
127
cy . findByRole ( 'combobox' , { name : / w h o i s y o u r e m p l o y e r / i } ) . type (
128
- 'Capgemini {enter}'
128
+ 'Cap {enter}'
129
129
)
130
130
cy . findByRole ( 'button' , { name : / s u b m i t / i } ) . click ( )
131
131
132
132
cy . wait ( '@createVolunteer' ) . then ( ( { request : { body : payload } } ) => {
133
133
expect ( payload ) . to . have . property ( 'hearAboutCYF' , 'Employer' )
134
- expect ( payload ) . to . have . property ( 'employer' , 'Capgemini' )
135
- } )
136
-
137
- cy . wait ( '@getEmployers' ) . then ( res => {
138
- const employers = res . response . body . employers
139
- expect ( res . response . statusCode ) . to . equal ( 200 )
140
- expect ( employers ) . to . be . an ( 'array' )
141
- expect ( employers ) . to . have . length . above ( 0 )
142
- expect ( employers ) . to . deep . include ( { _id : '6569' , name : 'Capgemini' } )
134
+ expect ( payload ) . to . have . property ( 'employer' , '6569' )
143
135
} )
144
136
} )
145
137
Original file line number Diff line number Diff line change @@ -38,8 +38,8 @@ class Forms extends Component {
38
38
39
39
fetchEmployers = async ( ) => {
40
40
try {
41
- const employersResponse = await axios . get ( `${ domain ( ) } /employers` )
42
- const employersData = employersResponse . data
41
+ const response = await axios . get ( `${ domain ( ) } /employers` )
42
+ const employersData = response . data . employers
43
43
employersData . sort ( ( a , b ) => a . name . localeCompare ( b . name ) )
44
44
this . setState ( { employersOptions : employersData } )
45
45
} catch ( err ) {
You can’t perform that action at this time.
0 commit comments