pose-core
Version:
Factory for Pose animation state machines
15 lines (12 loc) • 398 B
text/typescript
import { sortByReversePriority } from '../utils';
const PRIORITY = ['a', 'c'];
test('sort by priority', () => {
expect(['c', 'a'].sort(sortByReversePriority(PRIORITY))).toEqual(['a', 'c']);
expect(['b', 'd'].sort(sortByReversePriority(PRIORITY))).toEqual(['b', 'd']);
expect(['c', 'b', 'd', 'a'].sort(sortByReversePriority(PRIORITY))).toEqual([
'b',
'd',
'a',
'c'
]);
});