Skip to content

test: add tests#135

Open
mykhailokurochkin wants to merge 3 commits intomate-academy:mainfrom
mykhailokurochkin:develop
Open

test: add tests#135
mykhailokurochkin wants to merge 3 commits intomate-academy:mainfrom
mykhailokurochkin:develop

Conversation

@mykhailokurochkin
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

Thank you for your submission! You've done a great job setting up the test suite and covering the main success and failure scenarios.

However, this requires changes because the test coverage is incomplete for several key validation rules from the task description. To ensure the validateRegisterForm function is fully tested, please add test cases for the following scenarios:

  • Password validation:
    • A password longer than 16 characters.
    • A password missing a required uppercase letter.
    • A password missing a required special character.
  • Email validation:
    • An email missing the @ symbol.
    • An email with invalid period placement (e.g., test.@example.com).

Adding these tests is essential to confirm that the validation logic handles all required cases correctly. I look forward to seeing your updated submission!


✨ 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 +43 to +48
it(`should return error for valid email and too short password`, () => {
const result = validateRegisterForm('valid@email.com', 'P@s1!');

expect(result.code).toBe(422);
expect(result.message).toBe('Password is invalid.');
});

Choose a reason for hiding this comment

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

Your tests cover many important cases! To make the suite more comprehensive, consider adding tests for these two password requirements from the description:

  1. Maximum length: A test for a password longer than 16 characters is missing.
  2. Cyrillic characters: A test with a valid password that includes Cyrillic letters would confirm that requirement is met.

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

Great progress on adding more tests! The coverage is much more comprehensive now. However, this submission requires a few changes to be complete.

One of your test cases for an 'invalid email and valid password' uses the password 'P@ssword1', which is actually invalid because it's missing a special character. Please update it to use a password that meets all criteria, such as 'P@ssword1!'.

Additionally, to make the test suite fully cover the requirements, please add tests for the following scenarios:

  • A valid password containing Cyrillic letters (e.g., 'Пароль!1').
  • An email starting with a dot (e.g., .test@example.com).
  • An email with consecutive dots (e.g., test..dots@example.com).

Once these are addressed, your solution will be ready. Keep up the great work!


✨ 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 +32 to +40
it(`should return error for invalid email and valid password`, () => {
const invalidEmail = validateRegisterForm(
'test@com',
'P@ssword1'
);

expect(invalidEmail.code).toBe(422);
expect(invalidEmail.message).toBe('Email is invalid.');
});

Choose a reason for hiding this comment

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

This test case appears to follow an example from the task description, but the password 'P@ssword1' is actually invalid because it's missing a special character, according to the requirements.

To properly test the scenario for an 'invalid email and valid password', please update this test to use a password that meets all the criteria, such as 'P@ssword1!'.

expect(invalidDot.message).toBe('Email is invalid.');
}
);
});

Choose a reason for hiding this comment

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

Excellent work on adding more tests! The coverage is much more comprehensive now. To make it complete, please consider adding test cases for these remaining scenarios from the requirements:

  • A valid password containing Cyrillic letters (e.g., 'Пароль!1').
  • An email starting with a dot (e.g., .test@example.com).
  • An email with consecutive dots (e.g., test..dots@example.com).

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

Great work on this task! I am approving your solution so you can continue to the next stage. This is an educational approval, as there's one small correction needed.

You've done an excellent job adding the new test cases for email validation, which makes the test suite much stronger. The only thing to fix is the test for passwords with Cyrillic letters in src/validateRegisterForm.test.js. The current password, 'P@ssword!1A', only contains Latin characters and doesn't actually test the requirement. To fix this, please update it to include Cyrillic letters, for example: 'Пароль!1A'.

Keep up the fantastic effort!


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

Footnotes

  1. Rate AI review example

Comment on lines +117 to +120
it('should accept valid password containing Cyrillic letters', () => {
const result = validateRegisterForm(
'valid@email.com',
'P@ssword!1A'

Choose a reason for hiding this comment

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

This test case is intended to verify that passwords with Cyrillic letters are accepted, but the password 'P@ssword!1A' only contains Latin characters. To properly test this requirement, please use a password that includes Cyrillic letters, for example, 'Пароль!1A'.

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