Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce Transform: sort order is preserved as entered by user (#24494)
- Loading branch information
1 parent
c3b6ee1
commit e341d4b
Showing
2 changed files
with
41 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Registry } from './Registry'; | ||
import { FieldReducerInfo, fieldReducers, ReducerID } from '../transformations'; | ||
|
||
describe('Registry', () => { | ||
describe('selectOptions', () => { | ||
describe('when called with current', () => { | ||
it('then order in select.current should be same as current', () => { | ||
const list = fieldReducers.list(); | ||
const registry = new Registry<FieldReducerInfo>(() => list); | ||
const current = [ReducerID.step, ReducerID.mean, ReducerID.allIsZero, ReducerID.first, ReducerID.delta]; | ||
const select = registry.selectOptions(current); | ||
expect(select.current).toEqual([ | ||
{ description: 'Minimum interval between values', label: 'Step', value: 'step' }, | ||
{ description: 'Average Value', label: 'Mean', value: 'mean' }, | ||
{ description: 'All values are zero', label: 'All Zeros', value: 'allIsZero' }, | ||
{ description: 'First Value', label: 'First', value: 'first' }, | ||
{ description: 'Cumulative change in value', label: 'Delta', value: 'delta' }, | ||
]); | ||
}); | ||
|
||
describe('when called without current', () => { | ||
it('then it should return an empty array', () => { | ||
const list = fieldReducers.list(); | ||
const registry = new Registry<FieldReducerInfo>(() => list); | ||
const select = registry.selectOptions(); | ||
expect(select.current).toEqual([]); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters