From 893e4df6cded887c906f3425f438fb4b0ed78bab Mon Sep 17 00:00:00 2001 From: Uladzislau Date: Wed, 16 Sep 2026 17:41:20 +0200 Subject: [PATCH 1/2] add solution --- src/arrayReverse.test.js | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/arrayReverse.test.js b/src/arrayReverse.test.js index 6e7ca36..8bd4392 100644 --- a/src/arrayReverse.test.js +++ b/src/arrayReverse.test.js @@ -7,12 +7,37 @@ describe(`Function 'arrayReverse':`, () => { expect(arrayReverse).toBeInstanceOf(Function); }); - it(`should return an array`, () => {}); + it('should return an array', () => { + expect(Array.isArray(arrayReverse(['abc']))).toBe(true); + }); + + it(`should return an array with an empty string + if original array consists of an empty string`, () => { + expect(arrayReverse([''])).toEqual(['']); + }); + + it(`should reverse a single string`, () => { + expect(arrayReverse(['Hello'])).toEqual(['olleH']); + }); - it(`should return an empty string - if original array consists of an empty string`, () => { + it(`should reverse multiple strings and preserve their original lengths`, () => { expect(arrayReverse(['Mate', 'Academy'])).toEqual(['ymed', 'acAetaM']); }); - // write more tests here + it(`should reverse strings with numbers and special symbols`, () => { + expect(arrayReverse(['a1', '#$'])).toEqual(['$#', '1a']); + }); + + it(`should reverse strings of different lengths`, () => { + expect(arrayReverse(['I', 'am', 'a', 'student!'])).toEqual([ + '!', + 'tn', + 'e', + 'dutsamaI', + ]); + }); + + it(`should return an array with empty strings if original array consists of empty strings`, () => { + expect(arrayReverse(['', '', ''])).toEqual(['', '', '']); + }); }); From d1fc842d587cbddfb6b234b67d205e9dd5437aae Mon Sep 17 00:00:00 2001 From: Uladzislau Date: Thu, 17 Sep 2026 08:10:09 +0200 Subject: [PATCH 2/2] fix solution --- src/arrayReverse.test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/arrayReverse.test.js b/src/arrayReverse.test.js index 8bd4392..ca24d7c 100644 --- a/src/arrayReverse.test.js +++ b/src/arrayReverse.test.js @@ -40,4 +40,8 @@ describe(`Function 'arrayReverse':`, () => { it(`should return an array with empty strings if original array consists of empty strings`, () => { expect(arrayReverse(['', '', ''])).toEqual(['', '', '']); }); + + it(`should preserve an empty string between non-empty strings`, () => { + expect(arrayReverse(['ab', '', 'c'])).toEqual(['cb', '', 'a']); + }); });