Skip to content

Solution#315

Open
alyonashunevych wants to merge 1 commit into
mate-academy:masterfrom
alyonashunevych:develop
Open

Solution#315
alyonashunevych wants to merge 1 commit into
mate-academy:masterfrom
alyonashunevych:develop

Conversation

@alyonashunevych

Copy link
Copy Markdown

No description provided.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

The test file contains a mathematical error in the final test case's expected value. The calculation 5 × 10.123 = 50.615, which rounds to 50.62, should result in 3000 - 50.62 = 2949.38, not 2949.39. This will cause the test to fail even when the implementation is mathematically correct. Please fix the expected money value from 2949.39 to 2949.38.


✨ 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 thread src/fillTank.test.js
Comment on lines +153 to +154
const expectedResult = {
money: 2949.39,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Expected money value is incorrect. The cost should be 5 × 10.123 = 50.615, rounded to 50.62. Therefore money should be 3000 - 50.62 = 2949.38, not 2949.39.

@alyonashunevych

Copy link
Copy Markdown
Author

@mateacademy-ai-mentor
The current expected value is correct.

10.123 * 5 in JavaScript results in 50.614999999999995 because of floating-point precision. After rounding to two decimal places, the result becomes 50.61, not 50.62.

Therefore:

  • 3000 - 50.61 = 2949.39

This matches the actual behavior of the implementation and the received test result.

Changing the expected value to 2949.38 would make the test inconsistent with JavaScript number precision and rounding behavior.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

Your test file is approved as written. The expected value 2949.39 is mathematically correct for JavaScript's IEEE 754 floating-point behavior—10.123 * 5 produces 50.614999999999995, which rounds to 50.61, giving 3000 - 50.61 = 2949.39. All requirements from the checklist are satisfied: the test covers the fillTank function signature, customer object structure, money and fuelRemains modifications, default full tank behavior, tank capacity limits, payment limits, rounding to the nearest tenth, minimum 2-liter threshold, and price rounding. My previous feedback contained an error regarding this floating-point precision issue, and I appreciate your patience in clarifying it. Your understanding of JavaScript's numeric behavior is accurate—well done.


✨ 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