Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your Jest tests for arrayReverse cover the core required behavior (function existence, return type, preservation of original string lengths, and the main example cases), so the solution can move forward as submitted. The main thing to improve is the test in src/arrayReverse.test.js whose description says "should return an empty string if original array consists of an empty string" but whose assertion actually checks arrayReverse(['Mate', 'Academy']) and expects ['ymed', 'acAetaM']; updating either the test title to describe that multi-word behavior, or the assertion to actually test [''] -> [''], will remove this confusion. As a minor enhancement for coverage, consider adding explicit tests for arrayReverse(['']) and arrayReverse([]) so the empty-string and empty-array edge cases are clearly specified. It would also be helpful to clarify in one test description whether the array order is expected to change or stay the same, since your examples keep the original order even though some wording of the task might suggest reversing the array itself. Overall, the test suite is well-structured and validates the key algorithm; tightening these descriptions and edge cases will make it even clearer for future readers.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| const result = arrayReverse(['a', 'b', 'c']); | ||
|
|
||
| expect(Array.isArray(result)).toBeTruthy(); | ||
| }); |
There was a problem hiding this comment.
The test title says: "should return an empty string if original array consists of an empty string", but the assertion checks arrayReverse(['Mate', 'Academy']) expecting ['ymed', 'acAetaM']. This is inconsistent and confusing. Either update the test title to describe the actual assertion (e.g., "should reverse strings and preserve lengths for multiple words") or change the assertion to actually test the empty-string case (for example expect(arrayReverse([''])).toEqual([''])) if that behavior should be covered.
No description provided.