diff --git a/src/arrayReverse.test.js b/src/arrayReverse.test.js index 6e7ca36..6dea300 100644 --- a/src/arrayReverse.test.js +++ b/src/arrayReverse.test.js @@ -7,12 +7,45 @@ describe(`Function 'arrayReverse':`, () => { expect(arrayReverse).toBeInstanceOf(Function); }); - it(`should return an array`, () => {}); + it(`should return an array`, () => { + const input = ['Hello', 'World']; + + expect(Array.isArray(arrayReverse(input))).toBe(true); + }); it(`should return an empty string if original array consists of an empty string`, () => { - expect(arrayReverse(['Mate', 'Academy'])).toEqual(['ymed', 'acAetaM']); + expect(arrayReverse([''])).toEqual(['']); + }); + + test('reverses characters and preserves original length', () => { + const input = ['I', 'am', 'a', 'student!']; + + expect(arrayReverse(input)).toEqual(['!', 'tn', 'e', 'dutsamaI']); + }); + + test(`reverses one string with a digit + and a special character as well`, () => { + const input = ['Hell0!']; + + expect(arrayReverse(input)).toEqual(['!0lleH']); }); - // write more tests here + test('reverses an empty string', () => { + const input = ['']; + + expect(arrayReverse(input)).toEqual(['']); + }); + + test('reverses an array with mixed empty and non-empty strings', () => { + const input = ['koteł', '', 'pieseł']; + + expect(arrayReverse(input)).toEqual(['łesei', '', 'płetok']); + }); + + test('handles an empty array', () => { + const input = []; + + expect(arrayReverse(input)).toEqual([]); + }); });