Skip to content

jsArrayReverseC1#171

Open
SerhiiSemennikov wants to merge 4 commits intomate-academy:mainfrom
SerhiiSemennikov:develop
Open

jsArrayReverseC1#171
SerhiiSemennikov wants to merge 4 commits intomate-academy:mainfrom
SerhiiSemennikov:develop

Conversation

@SerhiiSemennikov
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Excellent work on this task! You've covered all the requirements and added some very thorough edge case tests. I am requesting one small change in src/arrayReverse.test.js before this can be approved. The test case it('should return an array', ...) has a few issues that make it incorrect:

  • The assertion expect(result).toContain("arba", "daCarbA") is invalid because .toContain() only accepts a single argument.
  • The expected value 'daCarbA' appears to be a typo; it should be 'darbaC'.
  • The multiple assertions are redundant and can be simplified.

Please update this test to use a single, correct expect(result).toEqual(['arba', 'darbaC']) and give the test a more descriptive name. Once that's fixed, it will be perfect!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment on lines +10 to +18
it(`should return an array`, () => {
const result = arrayReverse(["Abra", "Cadabra"]);
expect(result).toEqual(["arba", "daCarbA"]);
expect(result).toContain("arba", "daCarbA");
expect(result[0]).toMatch(/arba/);
expect(result[1]).toMatch("daCarbA");
expect(result).toBeInstanceOf(Array);
expect(arrayReverse(result)).toEqual(["Abra", "Cadabra"]);
});

Choose a reason for hiding this comment

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

This test case has a few areas for improvement:

  1. The description 'should return an array' is too generic. A more descriptive name like 'should correctly reverse an array of two strings' would be better.
  2. The assertion expect(result).toContain("arba", "daCarbA") on line 13 is incorrect. The .toContain() matcher only accepts a single argument to check for one element's existence in the array.
  3. The assertions on lines 13-16 are redundant. The first assertion expect(result).toEqual(['arba', 'daCarbA']) is sufficient as it checks the array's contents, order, and type. It's a good practice to keep tests focused on a single logical assertion.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Excellent work addressing the feedback from the last review! The test suite is now much clearer. However, there is one small logical error in a test case that needs to be corrected.

In src/arrayReverse.test.js, the test should correctly reverse an array of two strings' has an incorrect expected value. For the input ['Abra', 'Cadabra'], the concatenated string is "AbraCadabra". When reversed, this becomes "arbaDacarbA". Splitting this by the original lengths (4 and 7) should result in ['arba', 'DacarbA']. Please update the assertion to reflect this correct output.

I also noticed a minor typo in that same test description with an extra single quote at the end. Once the assertion is fixed, this will be ready for approval!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

});

it(`should return an array`, () => {
it(`should correctly reverse an array of two strings'`, () => {

Choose a reason for hiding this comment

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

There's a small typo here with an extra single quote at the end of the test description string.

it(`should return an array`, () => {
it(`should correctly reverse an array of two strings'`, () => {
const result = arrayReverse(["Abra", "Cadabra"]);
expect(result).toEqual(["arba", "daCarbA"]);

Choose a reason for hiding this comment

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

This expected value is still incorrect. When you concatenate and reverse ['Abra', 'Cadabra'], the reversed string is 'arbaCadabrA'. Splitting this by the original lengths (4 and 7) should result in ['arba', 'CadabrA']. Please double-check the logic to ensure your test case is correct.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Sorry, the pull request review was unsuccessful for the following reasons:

Warning

No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: NCM]

If the issue is within your control, please address it.
The next review attempt will automatically launch in about 1 hour.
If you believe this is an error or need assistance, please contact the support team.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Excellent work on this task! I'm happy to approve your solution. You've done a fantastic job addressing the feedback from the previous review, and the test suite is now robust and correct. The test coverage is outstanding, covering all the required examples and thoughtfully including important edge cases like empty arrays and empty strings. Keep up the great work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants