diff --git a/src/arrayReverse.test.js b/src/arrayReverse.test.js index cf8ac47..c3cbde0 100644 --- a/src/arrayReverse.test.js +++ b/src/arrayReverse.test.js @@ -2,13 +2,27 @@ describe(`Function 'arrayReverse':`, () => { const arrayReverse = require('./arrayReverse'); + const cases = [ + { + words: ['Hell0'], + expect: ['0lleH'], + }, + { + words: ['Mate', 'Academy'], + expect: ['ymed', 'acAetaM'], + }, + { + words: ['I', 'am', 'a', 'student!'], + expect: ['!', 'tn', 'e', 'dutsamaI'], + }, + ]; it(`should be declared`, () => { expect(arrayReverse).toBeInstanceOf(Function); }); it(`should return an array`, () => { - + expect(arrayReverse(['1', '1', '1'])).toBeInstanceOf(Array); }); it(`should return an empty string @@ -16,5 +30,10 @@ describe(`Function 'arrayReverse':`, () => { expect(arrayReverse(['Mate', 'Academy'])).toEqual(['ymed', 'acAetaM']); }); - // write more tests here + it.each(cases)( + 'should return expected output', + ({ words, expect: expected }) => { + expect(arrayReverse([...words])).toEqual(expected); + } + ); });