test: shufleArr function

pull/10/head
sundowndev 2019-10-23 22:49:24 +02:00
parent 867d600cde
commit ea235159fb
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
import { shuffleArray } from '@/utils';
describe('Utils - /src/utils/index.ts', () => {
describe('#shuffleArr', () => {
it('should not change array', () => {
const arr = [1];
expect(shuffleArray(arr)).toStrictEqual(arr);
});
it('should have correct length', () => {
const arr = 'the quick brown fox jumps over the lazy dog'.split(' ');
expect(shuffleArray(arr).length).toEqual(9);
});
it('should return an array', () => {
const arr = 'the quick brown fox jumps over the lazy dog'.split(' ');
expect(Array.isArray(shuffleArray(arr))).toEqual(true);
});
});
});