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