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
33 changes: 31 additions & 2 deletions src/arrayReverse.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,42 @@ describe(`Function 'arrayReverse':`, () => {
});

it(`should return an array`, () => {
expect(arrayReverse([])).toBeInstanceOf(Array);
});

it(`should return an empty array`, () => {
expect(arrayReverse([])).toEqual([]);
});

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 the same string if it consists of one character', () => {
expect(arrayReverse(['a'])).toEqual(['a']);
});

// write more tests here
it(`should return reversed string
if the original array consists of one word`, () => {
expect(arrayReverse(['Hell0'])).toEqual(['0lleH']);
});

it(`should return reversed string
if original array consists of string with numbers`, () => {
expect(arrayReverse(['h311o'])).toEqual(['o113h']);
});

it(`should return reversed string
if original array consists of string with special symbols`, () => {
expect(arrayReverse(['h@llo!'])).toEqual(['!oll@h']);
});

it(`should return array with reversed words
if original array consists of several words`, () => {
expect(arrayReverse(['Mate', 'Academy'])).toEqual(['ymed', 'acAetaM']);

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