From 9bf1bc80ae9eb5cf8342c8ef94ad0dc9e05c0bcf Mon Sep 17 00:00:00 2001 From: Alexandr Date: Sun, 26 Apr 2026 16:24:05 +0200 Subject: [PATCH] Solution --- src/arrayReverse.test.js | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/src/arrayReverse.test.js b/src/arrayReverse.test.js index 6e7ca36..f9c3336 100644 --- a/src/arrayReverse.test.js +++ b/src/arrayReverse.test.js @@ -7,12 +7,43 @@ describe(`Function 'arrayReverse':`, () => { expect(arrayReverse).toBeInstanceOf(Function); }); - it(`should return an array`, () => {}); + it(`should return an array`, () => { + expect(Array.isArray(arrayReverse(['a']))).toBe(true); + }); + + it(`should correctly reverse a single string`, () => { + expect(arrayReverse(['Hell0'])).toEqual(['0lleH']); + }); - it(`should return an empty string - if original array consists of an empty string`, () => { + it(`should correctly reverse multiple strings and preserve chunk sizes`, () => { expect(arrayReverse(['Mate', 'Academy'])).toEqual(['ymed', 'acAetaM']); }); - // write more tests here + it(`should work with single-character strings`, () => { + expect(arrayReverse(['I', 'am', 'a', 'student!'])) + .toEqual(['!', 'tn', 'e', 'dutsamaI']); + }); + + it(`should handle empty array`, () => { + expect(arrayReverse([])).toEqual([]); + }); + + it(`should handle array with empty string`, () => { + expect(arrayReverse([''])).toEqual(['']); + }); + + it(`should work with numbers and special symbols inside strings`, () => { + expect(arrayReverse(['a1!', 'B2@', '#c3'])) + .toEqual(['3c#', '@2B', '!1a']); + }); + + it(`should preserve total length of characters`, () => { + const input = ['abc', 'de!f', 'G']; + const result = arrayReverse(input); + + const inputLength = input.join('').length; + const resultLength = result.join('').length; + + expect(resultLength).toBe(inputLength); + }); });