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

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

it(`should return an array with 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 a single string`, () => {
expect(arrayReverse(['Hello'])).toEqual(['olleH']);
});

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

// write more tests here
it(`should reverse strings with numbers and special symbols`, () => {
expect(arrayReverse(['a1', '#$'])).toEqual(['$#', '1a']);
});

it(`should reverse strings of different lengths`, () => {
expect(arrayReverse(['I', 'am', 'a', 'student!'])).toEqual([
'!',
'tn',
'e',
'dutsamaI',
]);
});

it(`should return an array with empty strings if original array consists of empty strings`, () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dodaj przypadek z pustym elementem miedzy niepustymi, np. ['ab', '', 'c'] -> ['cb', '', 'a'], zeby test wykryl implementacje, ktora gubi pusty slot

expect(arrayReverse(['', '', ''])).toEqual(['', '', '']);
});

it(`should preserve an empty string between non-empty strings`, () => {
expect(arrayReverse(['ab', '', 'c'])).toEqual(['cb', '', 'a']);
});
});
Loading