From 2fe467fd8b84d81b91b5a9a149dd567135b13d19 Mon Sep 17 00:00:00 2001 From: Olga Berezhna <57196165+oberezhnay@users.noreply.github.com> Date: Mon, 21 Sep 2026 12:33:23 +0300 Subject: [PATCH 1/3] Add tests for arrayReverse function --- src/arrayReverse.test.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/arrayReverse.test.js b/src/arrayReverse.test.js index 6e7ca36..7548f15 100644 --- a/src/arrayReverse.test.js +++ b/src/arrayReverse.test.js @@ -7,12 +7,28 @@ describe(`Function 'arrayReverse':`, () => { expect(arrayReverse).toBeInstanceOf(Function); }); - it(`should return an array`, () => {}); + it(`should return an array`, () => { + const result = arrayReverse(['hello', 'world']); + expect(result).toBeInstanceOf(Array); + }); 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 a reversed string`, () => { + expect(arrayReverse(['Hell0'])).toEqual(['0lleH']); + }); + + it(`should return reversed strings`, () => { + const result = arrayReverse(['Mate', 'Academy']); + expect(result).toEqual(['ymed', 'aceteM']); + }); + + it(`should return reversed strings right length`, () => { + expect(arrayReverse(['I', 'am', 'a', 'student!'])) + .toEqual(['!', 'tn', 'e', 'dutsamaI']); }); - // write more tests here }); From 172c96b665eeaefd29958712ac44f913e560651a Mon Sep 17 00:00:00 2001 From: Olga Berezhna <57196165+oberezhnay@users.noreply.github.com> Date: Mon, 21 Sep 2026 12:42:30 +0300 Subject: [PATCH 2/3] Fix expected result of should return reversed strings test --- src/arrayReverse.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arrayReverse.test.js b/src/arrayReverse.test.js index 7548f15..cb7fce0 100644 --- a/src/arrayReverse.test.js +++ b/src/arrayReverse.test.js @@ -23,7 +23,7 @@ describe(`Function 'arrayReverse':`, () => { it(`should return reversed strings`, () => { const result = arrayReverse(['Mate', 'Academy']); - expect(result).toEqual(['ymed', 'aceteM']); + expect(result).toEqual(['ymed', 'acAeteM']); }); it(`should return reversed strings right length`, () => { From ae8a6966b92971b4e24c4abe1c119c6cad00433d Mon Sep 17 00:00:00 2001 From: Olga Berezhna <57196165+oberezhnay@users.noreply.github.com> Date: Mon, 21 Sep 2026 12:44:43 +0300 Subject: [PATCH 3/3] fix test expected result --- src/arrayReverse.test.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/arrayReverse.test.js b/src/arrayReverse.test.js index cb7fce0..0e4af32 100644 --- a/src/arrayReverse.test.js +++ b/src/arrayReverse.test.js @@ -9,6 +9,7 @@ describe(`Function 'arrayReverse':`, () => { it(`should return an array`, () => { const result = arrayReverse(['hello', 'world']); + expect(result).toBeInstanceOf(Array); }); @@ -23,12 +24,16 @@ describe(`Function 'arrayReverse':`, () => { it(`should return reversed strings`, () => { const result = arrayReverse(['Mate', 'Academy']); - expect(result).toEqual(['ymed', 'acAeteM']); + + expect(result).toEqual(['ymed', 'acAetaM']); }); it(`should return reversed strings right length`, () => { - expect(arrayReverse(['I', 'am', 'a', 'student!'])) - .toEqual(['!', 'tn', 'e', 'dutsamaI']); + expect(arrayReverse(['I', 'am', 'a', 'student!'])).toEqual([ + '!', + 'tn', + 'e', + 'dutsamaI', + ]); }); - });