-
Notifications
You must be signed in to change notification settings - Fork 196
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 all commits
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,28 @@ 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([''])).toEqual(['']); | ||
| }); | ||
|
|
||
| it('should reverses a single word', () => { | ||
|
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 test title says it should check the empty-string case, but the assertion checks |
||
| expect(arrayReverse(['Hell0'])).toEqual(['0lleH']); | ||
| }); | ||
|
|
||
| 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 |
||
| }); | ||
|
|
||
| // write more tests here | ||
| 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']); | ||
| }); | ||
| }); | ||
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.
Optional improvement: add a test that includes an empty string among other elements to cover mixed cases, for example:
Consider adding this after the existing empty-string test to improve edge-case coverage.