Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src/arrayReverse.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,26 @@ describe(`Function 'arrayReverse':`, () => {
expect(arrayReverse(['Mate', 'Academy'])).toEqual(['ymed', 'acAetaM']);
});

// write more tests here
it(`should reverse single word`, () => {
expect(arrayReverse(['Hell0'])).toEqual(['0lleH']);
});

it(`should reverse multiple words preserving lengths`, () => {
expect(arrayReverse(['Mate', 'Academy'])).toEqual(['ymed', 'acAetaM']);

expect(arrayReverse(['I', 'am', 'a', 'student!']))
.toEqual(['!', 'tn', 'e', 'dutsamaI']);
});

it(`should handle words with numbers and special characters`, () => {
expect(arrayReverse(['123', '!@#'])).toEqual(['#@!', '321']);
});

it(`should handle single-character words`, () => {
expect(arrayReverse(['a', 'b', 'c'])).toEqual(['c', 'b', 'a']);
});

it(`should handle empty strings inside array`, () => {
expect(arrayReverse(['', 'abc', ''])).toEqual(['', 'cba', '']);
});
});