import { createNumberHandler } from './create_number_handler' ; describe ( 'createNumberHandler()' , ( ) => { let handleChange ; let changeHandler ; let event ; beforeEach ( ( ) => { handleChange = jest . fn ( ) ; changeHandler = createNumberHandler ( handleChange ) ; event = { preventDefault : jest . fn ( ) , target : { value : '1' } , } as unknown as React . ChangeEvent < HTMLInputElement > ; const fn = changeHandler ( 'unit' ) ; fn ( event ) ; } ) ; test ( 'calls handleChange() function with partial' , ( ) => { expect ( handleChange . mock . calls . length ) . toEqual ( 1 ) ; expect ( handleChange . mock . calls [ 0 ] [ 0 ] ) . toEqual ( { unit : 1 , } ) ; } ) ; } ) ;