aboutsummaryrefslogtreecommitdiffstats
path: root/test/helpers/array-helpers.test.ts
blob: 135123b6adcf21ccec5bd3236059576bbd1ce39f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import shuffleArray from '../../src/helpers/array-helpers';

describe('array_helpers', () => {
  it('isValidExternalURL', () => {
    const originalArray = ['a', 'b', 'c'];
    const shuffledArray = shuffleArray(originalArray);

    // Expect the arrays to be exactly the same
    // when both are sorted alphabetically
    expect(shuffledArray.toSorted((a, b) => a.localeCompare(b))).toEqual(
      originalArray.toSorted((a, b) => a.localeCompare(b)),
    );
  });
});