mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-10 01:43:43 +00:00
refactor: order is single source of truth
This commit is contained in:
committed by
Carlos Valente
parent
e7cfb7d9d9
commit
2793aadea0
@@ -88,12 +88,18 @@ describe('deleteAtIndex', () => {
|
||||
});
|
||||
|
||||
describe('reorderArray', () => {
|
||||
it('should reorder an item in the array', () => {
|
||||
it('should reorder an item in the array (up)', () => {
|
||||
const array = ['a', 'b', 'c', 'd'];
|
||||
const result = reorderArray(array, 1, 3);
|
||||
expect(result).toEqual(['a', 'c', 'd', 'b']);
|
||||
});
|
||||
|
||||
it('should reorder an item in the array (down)', () => {
|
||||
const array = ['a', 'b', 'c', 'd'];
|
||||
const result = reorderArray(array, 3, 1);
|
||||
expect(result).toEqual(['a', 'd', 'b', 'c']);
|
||||
});
|
||||
|
||||
it('should return the original array if fromIndex and toIndex are the same', () => {
|
||||
const array = ['a', 'b', 'c'];
|
||||
const result = reorderArray(array, 1, 1);
|
||||
|
||||
Reference in New Issue
Block a user