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
38 changes: 34 additions & 4 deletions src/arrayReverse.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,42 @@ describe(`Function 'arrayReverse':`, () => {
expect(arrayReverse).toBeInstanceOf(Function);
});

it(`should return an array`, () => {});
it(`should return an array`, () => {
expect(Array.isArray(arrayReverse(['Hell0']))).toBe(true);
});

it(`should return an empty string if original array consists of an empty string`, () => {
expect(arrayReverse([''])).toEqual(['']);
});

it(`should return an empty string
if original array consists of an empty string`, () => {
it(`should reverse one string in array`, () => {
expect(arrayReverse(['Hell0'])).toEqual(['0lleH']);
});

it(`should reverse strings and their order`, () => {
expect(arrayReverse(['Mate', 'Academy'])).toEqual(['ymed', 'acAetaM']);
});

// write more tests here
it(`should keep original strings lengths after reverse`, () => {
expect(arrayReverse(['I', 'am', 'a', 'student!'])).toEqual([
'!',
'tn',
'e',
'dutsamaI',
]);
});

it(`should work with numbers and special symbols`, () => {
expect(arrayReverse(['12', '@#$%', 'abc'])).toEqual(['cb', 'a%$#', '@21']);
});

it(`should work with multiple empty strings`, () => {
expect(arrayReverse(['', '', ''])).toEqual(['', '', '']);
});

it(`should not change array length`, () => {
const result = arrayReverse(['Mate', 'Academy']);

expect(result.length).toBe(2);
});
});
Loading