@@ -163,7 +163,7 @@ describe('RecordHook e2e', () => {
163
163
let records = await getRecords ( sheetId )
164
164
expect ( records [ 0 ] . values [ 'firstName' ] . value ) . toBeUndefined ( )
165
165
expect ( records [ 0 ] . values [ 'lastName' ] . value ) . toBeUndefined ( )
166
- expect ( records [ 0 ] . values [ 'lastName' ] . messages . length ) . toBe ( 0 )
166
+ expect ( records [ 0 ] . values [ 'lastName' ] . messages ? .length ) . toBe ( 0 )
167
167
168
168
// Update the record with a first name, recordHook will add an error to lastName
169
169
await api . records . update ( sheetId , [
@@ -174,7 +174,7 @@ describe('RecordHook e2e', () => {
174
174
records = await getRecords ( sheetId )
175
175
expect ( records [ 0 ] . values [ 'firstName' ] . value ) . toBeDefined ( )
176
176
expect ( records [ 0 ] . values [ 'lastName' ] . value ) . toBeUndefined ( )
177
- expect ( records [ 0 ] . values [ 'lastName' ] . messages . length ) . toBe ( 1 )
177
+ expect ( records [ 0 ] . values [ 'lastName' ] . messages ? .length ) . toBe ( 1 )
178
178
179
179
// Update the record with a last name, recordHook will remove the error from lastName
180
180
await api . records . update ( sheetId , [
@@ -185,7 +185,7 @@ describe('RecordHook e2e', () => {
185
185
records = await getRecords ( sheetId )
186
186
expect ( records [ 0 ] . values [ 'firstName' ] . value ) . toBeUndefined ( )
187
187
expect ( records [ 0 ] . values [ 'lastName' ] . value ) . toBeUndefined ( )
188
- expect ( records [ 0 ] . values [ 'lastName' ] . messages . length ) . toBe ( 0 )
188
+ expect ( records [ 0 ] . values [ 'lastName' ] . messages ? .length ) . toBe ( 0 )
189
189
} )
190
190
191
191
it ( 'noop' , async ( ) => {
@@ -310,7 +310,7 @@ describe('RecordHook e2e', () => {
310
310
await createRecords ( sheetId , [ { email :
'[email protected] ' } ] )
311
311
await listener . waitFor ( 'commit:created' )
312
312
// Sleep for 500ms to allow time for the bulk record hook to be applied
313
- await new Promise ( resolve => setTimeout ( resolve , 500 ) ) ;
313
+ await new Promise ( ( resolve ) => setTimeout ( resolve , 500 ) )
314
314
315
315
const records = await getRecords ( sheetId )
316
316
@@ -340,7 +340,7 @@ describe('RecordHook e2e', () => {
340
340
let records = await getRecords ( sheetId )
341
341
expect ( records [ 0 ] . values [ 'firstName' ] . value ) . toBeUndefined ( )
342
342
expect ( records [ 0 ] . values [ 'lastName' ] . value ) . toBeUndefined ( )
343
- expect ( records [ 0 ] . values [ 'lastName' ] . messages . length ) . toBe ( 0 )
343
+ expect ( records [ 0 ] . values [ 'lastName' ] . messages ? .length ) . toBe ( 0 )
344
344
345
345
// Update the record with a first name, recordHook will add an error to lastName
346
346
await api . records . update ( sheetId , [
@@ -351,7 +351,7 @@ describe('RecordHook e2e', () => {
351
351
records = await getRecords ( sheetId )
352
352
expect ( records [ 0 ] . values [ 'firstName' ] . value ) . toBeDefined ( )
353
353
expect ( records [ 0 ] . values [ 'lastName' ] . value ) . toBeUndefined ( )
354
- expect ( records [ 0 ] . values [ 'lastName' ] . messages . length ) . toBe ( 1 )
354
+ expect ( records [ 0 ] . values [ 'lastName' ] . messages ? .length ) . toBe ( 1 )
355
355
356
356
// Update the record with a last name, recordHook will remove the error from lastName
357
357
await api . records . update ( sheetId , [
@@ -362,7 +362,7 @@ describe('RecordHook e2e', () => {
362
362
records = await getRecords ( sheetId )
363
363
expect ( records [ 0 ] . values [ 'firstName' ] . value ) . toBeUndefined ( )
364
364
expect ( records [ 0 ] . values [ 'lastName' ] . value ) . toBeUndefined ( )
365
- expect ( records [ 0 ] . values [ 'lastName' ] . messages . length ) . toBe ( 0 )
365
+ expect ( records [ 0 ] . values [ 'lastName' ] . messages ? .length ) . toBe ( 0 )
366
366
} )
367
367
368
368
it ( 'noop' , async ( ) => {
@@ -441,8 +441,8 @@ describe('RecordHook e2e', () => {
441
441
await listener . waitFor ( 'commit:created' )
442
442
const records = await getRecords ( sheetId )
443
443
444
- expect ( records [ 0 ] . config . fields . name . readonly ) . toEqual ( true )
445
- expect ( records [ 0 ] . config . fields . age . readonly ) . toEqual ( true )
444
+ expect ( records [ 0 ] . config ? .fields ?. [ ' name' ] . readonly ) . toEqual ( true )
445
+ expect ( records [ 0 ] . config ? .fields ?. [ ' age' ] . readonly ) . toEqual ( true )
446
446
} , 15_000 )
447
447
} )
448
448
} )
0 commit comments