import { GetDataFrameAnalyticsStatsResponseOk } from '../../../../../services/ml_api_service/data_frame_analytics' ; import { getAnalyticsJobsStats } from './get_analytics' ; import { DATA_FRAME_TASK_STATE } from '../../components/analytics_list/common' ; describe ( 'get_analytics' , ( ) => { test ( 'should get analytics jobs stats' , ( ) => { const mockResponse = { count : 2 , data_frame_analytics : [ { id : 'outlier-cloudwatch' , state : DATA_FRAME_TASK_STATE . STOPPED , progress : [ { phase : 'reindexing' , progress_percent : 0 , } , { phase : 'loading_data' , progress_percent : 0 , } , { phase : 'analyzing' , progress_percent : 0 , } , { phase : 'writing_results' , progress_percent : 0 , } , ] , } , { id : 'reg-gallery' , state : DATA_FRAME_TASK_STATE . FAILED , progress : [ { phase : 'reindexing' , progress_percent : 0 , } , { phase : 'loading_data' , progress_percent : 0 , } , { phase : 'analyzing' , progress_percent : 0 , } , { phase : 'writing_results' , progress_percent : 0 , } , ] , } , ] , } ; expect ( getAnalyticsJobsStats ( mockResponse ) ) . toEqual ( { total : { label : 'Total analytics jobs' , value : 2 , show : true , } , started : { label : 'Running' , value : 0 , show : true , } , stopped : { label : 'Stopped' , value : 1 , show : true , } , failed : { label : 'Failed' , value : 1 , show : true , } , } ) ; } ) ; } ) ;