-
Notifications
You must be signed in to change notification settings - Fork 200
qa array reverse solution #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,13 +8,32 @@ describe(`Function 'arrayReverse':`, () => { | |
| }); | ||
|
|
||
| it(`should return an array`, () => { | ||
|
|
||
| expect(arrayReverse(['1', '1', '1'])).toBeInstanceOf(Array); | ||
| }); | ||
|
|
||
| it(`should return an empty string | ||
| if original array consists of an empty string`, () => { | ||
| expect(arrayReverse(['Mate', 'Academy'])).toEqual(['ymed', 'acAetaM']); | ||
| }); | ||
|
|
||
| // write more tests here | ||
| it('should reverses a single word', () => { | ||
| expect(arrayReverse(['Hello'])).toEqual(['olleH']); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The task description requires the example There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The task description requires the exact example expect(arrayReverse(['Hell0'])).toEqual(['0lleH']);Place it near the other single-word tests so the required example is explicitly verified (see description) . |
||
| }); | ||
|
|
||
| it('should reverses two words and preserves their lengths', () => { | ||
| expect(arrayReverse(['Mate', 'Academy'])).toEqual(['ymed', 'acAetaM']); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| }); | ||
|
|
||
| it('should correctly transforms words of different lengths', () => { | ||
| expect(arrayReverse(['I', 'am', 'a', 'student!'])) | ||
| .toEqual(['!', 'tn', 'e', 'dutsamaI']); | ||
| }); | ||
|
|
||
| it('should works with digits and special characters', () => { | ||
| expect(arrayReverse(['12$', '#A!'])).toEqual(['!A#', '$21']); | ||
| }); | ||
|
|
||
| it('should returns empty array if input is empty', () => { | ||
| expect(arrayReverse([])).toEqual([]); | ||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test title says it should check the empty-string case, but the assertion checks
['Mate', 'Academy']. Either change the test body toexpect(arrayReverse([''])).toEqual([''])or update the test title and description to match the current assertion.