import React from 'react' ; import { mountHook } from '@kbn/test/jest' ; import { MlContext } from '../../../../../contexts/ml' ; import { kibanaContextValueMock } from '../../../../../contexts/ml/__mocks__/kibana_context_value' ; import { useCreateAnalyticsForm } from './use_create_analytics_form' ; const getMountedHook = ( ) => mountHook ( ( ) => useCreateAnalyticsForm ( ) , ( { children } ) => ( < MlContext . Provider value = { kibanaContextValueMock } > { children } < /MlContext.Provider>)); describe ( 'useCreateAnalyticsForm()' , ( ) => { test ( 'initialization' , ( ) => { const { getLastHookValue } = getMountedHook ( ) ; const { actions } = getLastHookValue ( ) ; expect ( typeof actions . createAnalyticsJob ) . toBe ( 'function' ) ; expect ( typeof actions . startAnalyticsJob ) . toBe ( 'function' ) ; expect ( typeof actions . setFormState ) . toBe ( 'function' ) ; } ) ; } ) ;