1import { Registry } from './Registry'; 2import { FieldReducerInfo, fieldReducers, ReducerID } from '../transformations'; 3 4describe('Registry', () => { 5 describe('selectOptions', () => { 6 describe('when called with current', () => { 7 it('then order in select.current should be same as current', () => { 8 const list = fieldReducers.list(); 9 const registry = new Registry<FieldReducerInfo>(() => list); 10 const current = [ReducerID.step, ReducerID.mean, ReducerID.allIsZero, ReducerID.first, ReducerID.delta]; 11 const select = registry.selectOptions(current); 12 expect(select.current).toEqual([ 13 { description: 'Minimum interval between values', label: 'Step', value: 'step' }, 14 { description: 'Average Value', label: 'Mean', value: 'mean' }, 15 { description: 'All values are zero', label: 'All Zeros', value: 'allIsZero' }, 16 { description: 'First Value', label: 'First', value: 'first' }, 17 { description: 'Cumulative change in value', label: 'Delta', value: 'delta' }, 18 ]); 19 }); 20 21 describe('when called without current', () => { 22 it('then it should return an empty array', () => { 23 const list = fieldReducers.list(); 24 const registry = new Registry<FieldReducerInfo>(() => list); 25 const select = registry.selectOptions(); 26 expect(select.current).toEqual([]); 27 }); 28 }); 29 }); 30 }); 31}); 32