From 3f9c2add671b862d34831a4b5df930b616db08e8 Mon Sep 17 00:00:00 2001 From: Andrzej Lipski Date: Fri, 11 Sep 2026 18:32:45 +0200 Subject: [PATCH 1/2] test: add array reverse coverage --- src/arrayReverse.test.js | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/src/arrayReverse.test.js b/src/arrayReverse.test.js index 6e7ca36..0a7c0ac 100644 --- a/src/arrayReverse.test.js +++ b/src/arrayReverse.test.js @@ -7,12 +7,38 @@ describe(`Function 'arrayReverse':`, () => { expect(arrayReverse).toBeInstanceOf(Function); }); - it(`should return an array`, () => {}); + it(`should return an array`, () => { + expect(arrayReverse(['Mate'])).toBeInstanceOf(Array); + }); + + it(`should return an empty array if the original array is empty`, () => { + expect(arrayReverse([])).toEqual([]); + }); - it(`should return an empty string - if original array consists of an empty string`, () => { + it(`should return an empty string if the original array consists of one`, () => { + expect(arrayReverse([''])).toEqual(['']); + }); + + it(`should reverse a single string`, () => { + expect(arrayReverse(['Hell0'])).toEqual(['0lleH']); + }); + + it(`should reverse all characters and keep the original string lengths`, () => { expect(arrayReverse(['Mate', 'Academy'])).toEqual(['ymed', 'acAetaM']); + + expect(arrayReverse(['I', 'am', 'a', 'student!'])).toEqual([ + '!', + 'tn', + 'e', + 'dutsamaI', + ]); }); - // write more tests here + it(`should reverse strings containing numbers and special symbols`, () => { + expect(arrayReverse(['abc', '12', '#$%'])).toEqual(['%$#', '21', 'cba']); + }); + + it(`should keep empty strings in their original positions`, () => { + expect(arrayReverse(['ab', '', 'Cde', ''])).toEqual(['ed', '', 'Cba', '']); + }); }); From ed15096f8cdfb5a8a6ede59109e05ff0d6b175e6 Mon Sep 17 00:00:00 2001 From: Andrzej Lipski Date: Tue, 15 Sep 2026 08:18:37 +0200 Subject: [PATCH 2/2] test: split array reverse test cases --- src/arrayReverse.test.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/arrayReverse.test.js b/src/arrayReverse.test.js index 0a7c0ac..9b72dd5 100644 --- a/src/arrayReverse.test.js +++ b/src/arrayReverse.test.js @@ -23,9 +23,11 @@ describe(`Function 'arrayReverse':`, () => { expect(arrayReverse(['Hell0'])).toEqual(['0lleH']); }); - it(`should reverse all characters and keep the original string lengths`, () => { + it(`should reverse strings and their order`, () => { expect(arrayReverse(['Mate', 'Academy'])).toEqual(['ymed', 'acAetaM']); + }); + it(`should preserve original string lengths when reversing`, () => { expect(arrayReverse(['I', 'am', 'a', 'student!'])).toEqual([ '!', 'tn',