import { convertFeaturesToIndicesArray } from './es_system_indices_migration' ; import { SystemIndicesMigrationStatus } from '../../common/types' ; const esUpgradeSystemIndicesStatusMock = { features : [ { feature_name : 'machine_learning' , minimum_index_version : '7.1.1' , migration_status : 'MIGRATION_NEEDED' , indices : [ { index : '.ml-config' , version : '7.1.1' , } , { index : '.ml-notifications' , version : '7.1.1' , } , ] , } , { feature_name : 'security' , minimum_index_version : '7.1.1' , migration_status : 'MIGRATION_NEEDED' , indices : [ { index : '.ml-config' , version : '7.1.1' , } , ] , } , ] , migration_status : 'MIGRATION_NEEDED' , } ; describe ( 'convertFeaturesToIndicesArray' , ( ) => { it ( 'converts list with features to flat array of uniq indices' , async ( ) => { const result = convertFeaturesToIndicesArray ( esUpgradeSystemIndicesStatusMock . features ) ; expect ( result ) . toEqual ( [ '.ml-config' , '.ml-notifications' ] ) ; } ) ; it ( 'returns empty array if no features are passed to it' , async ( ) => { expect ( convertFeaturesToIndicesArray ( [ ] ) ) . toEqual ( [ ] ) ; } ) ; } ) ;