@@ -124,12 +124,12 @@ const mockFile = ({
124
124
name,
125
125
size = 0 ,
126
126
type = 'text/plain' ,
127
- lastModified = new Date ( )
127
+ lastModified = new Date ( ) ,
128
128
} ) => {
129
- const blob = new Blob ( [ '0' . repeat ( size ) ] , { type } ) ;
130
- blob . lastModifiedDate = lastModified ;
131
- return new File ( [ blob ] , name ) ;
132
- } ;
129
+ const blob = new Blob ( [ '0' . repeat ( size ) ] , { type} )
130
+ blob . lastModifiedDate = lastModified
131
+ return new File ( [ blob ] , name )
132
+ }
133
133
134
134
beforeEach ( ( ) => {
135
135
jest . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } )
@@ -228,27 +228,28 @@ test('fireEvent.update does not trigger warning messages', async () => {
228
228
} )
229
229
230
230
test ( 'fireEvent.update should not crash with input file' , async ( ) => {
231
- const inputSpy = jest . fn ( ) ;
232
- const changeSpy = jest . fn ( ) ;
231
+ const spy = jest . fn ( )
233
232
234
233
const { getByTestId} = render ( {
235
234
render ( h ) {
236
235
return h ( 'input' , {
237
236
on : {
238
- input : inputSpy ,
239
- change : changeSpy
237
+ change : spy ,
240
238
} ,
241
239
attrs : {
242
240
type : 'file' ,
243
241
'data-testid' : 'test-update' ,
244
242
} ,
245
243
} )
246
- }
244
+ } ,
247
245
} )
248
246
249
- // should expect a array of list since it's a fileList
250
- await fireEvent . update ( getByTestId ( 'test-update' ) , [ mockFile ( { name : 'random.txt' , size : 524288 } ) ] )
247
+ // should expect an array of list since it's a fileList
248
+ await fireEvent . update ( getByTestId ( 'test-update' ) , [
249
+ mockFile ( { name : 'random.txt' , size : 524288 } ) ,
250
+ ] )
251
251
252
+ expect ( spy ) . toHaveBeenCalledTimes ( 1 )
252
253
expect ( console . warn ) . not . toHaveBeenCalled ( )
253
254
} )
254
255
0 commit comments