From e55f3cf82da591dfec1b25a2690df69b547cdbef Mon Sep 17 00:00:00 2001 From: Dmytro Date: Fri, 9 Jan 2026 01:29:04 +0200 Subject: [PATCH 1/2] implement tests --- src/arrayReverse.test.js | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/arrayReverse.test.js b/src/arrayReverse.test.js index cf8ac47..ee59c97 100644 --- a/src/arrayReverse.test.js +++ b/src/arrayReverse.test.js @@ -8,13 +8,40 @@ describe(`Function 'arrayReverse':`, () => { }); it(`should return an array`, () => { + expect(arrayReverse([])).toBeInstanceOf(Array); + }); + it(`should return an empty array`, () => { + expect(arrayReverse([])).toEqual([]); }); it(`should return an empty string if original array consists of an empty string`, () => { - expect(arrayReverse(['Mate', 'Academy'])).toEqual(['ymed', 'acAetaM']); + expect(arrayReverse([''])).toEqual(['']); + }); + + it('should return the same string if it consists of one character', () => { + expect(arrayReverse(['a'])).toEqual(['a']); + }); + + it(`should return reversed string + if the original array consists of one word`, () => { + expect(arrayReverse(['Hello'])).toEqual(['olleH']); }); - // write more tests here + it(`should return reversed string + if original array consists of string with numbers`, () => { + expect(arrayReverse(['h311o'])).toEqual(['o113h']); + }); + + it(`should return reversed string + if original array consists of string with special symbols`, () => { + expect(arrayReverse(['h@llo!'])).toEqual(['!oll@h']); + }); + + it(`should return array with reversed words + if original array consists of several words`, () => { + expect(arrayReverse([`It's not a lake,`, ` `, `it's an ocean`])) + .toEqual([`naeco na s'ti ,e`, `k`, `al a ton s'tI`]); + }); }); From 781bdb2afbfa4a42f0ae7c6ad13bf582f882fedd Mon Sep 17 00:00:00 2001 From: Dmytro Date: Fri, 9 Jan 2026 01:35:08 +0200 Subject: [PATCH 2/2] fix some tests --- src/arrayReverse.test.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/arrayReverse.test.js b/src/arrayReverse.test.js index ee59c97..b8d9700 100644 --- a/src/arrayReverse.test.js +++ b/src/arrayReverse.test.js @@ -26,7 +26,7 @@ describe(`Function 'arrayReverse':`, () => { it(`should return reversed string if the original array consists of one word`, () => { - expect(arrayReverse(['Hello'])).toEqual(['olleH']); + expect(arrayReverse(['Hell0'])).toEqual(['0lleH']); }); it(`should return reversed string @@ -41,7 +41,9 @@ describe(`Function 'arrayReverse':`, () => { it(`should return array with reversed words if original array consists of several words`, () => { - expect(arrayReverse([`It's not a lake,`, ` `, `it's an ocean`])) - .toEqual([`naeco na s'ti ,e`, `k`, `al a ton s'tI`]); + expect(arrayReverse(['Mate', 'Academy'])).toEqual(['ymed', 'acAetaM']); + + expect(arrayReverse(['I', 'am', 'a', 'student!'])) + .toEqual(['!', 'tn', 'e', 'dutsamaI']); }); });