1 import arraysContainSameElements from './arraysContainSameElements';
3 describe('arraysContainSameElements()', () => {
4 it('returns true for empty arrays', () => {
5 const result = arraysContainSameElements([], []);
7 expect(result).toBeTruthy();
10 it('returns false if arrays are of different length', () => {
11 const array1 = ['item 1', 'item 2', 'item 3'];
12 const array2 = ['item 1', 'item 2'];
14 const result = arraysContainSameElements(array1, array2);
16 expect(result).toBeFalsy();
19 it('returns true if items are the same and are in the same order', () => {
20 const array1 = ['item 1', 'item 2', 'item 3'];
21 const array2 = ['item 1', 'item 2', 'item 3'];
23 const result = arraysContainSameElements(array1, array2);
25 expect(result).toBeTruthy();
28 it('returns true if items are the same but out of order', () => {
29 const array1 = ['item 1', 'item 2', 'item 3'];
30 const array2 = ['item 1', 'item 3', 'item 2'];
32 const result = arraysContainSameElements(array1, array2);
34 expect(result).toBeTruthy();