Solution#668
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because the current test suite is missing several required example cases, which means it does not fully validate that getCoinCombination meets the specification. In src/getCoinCombination.test.js, you have good coverage for 0, 1, 5, 10, 25, and 41 cents, but there are no tests asserting the expected outputs for 6, 17, and 50 cents; these amounts are important because they check the minimal-coin behavior for tricky combinations (e.g., 6 -> [1,1,0,0], 17 -> [2,1,1,0], 50 -> [0,0,0,2]). These missing cases are critical because an incorrect implementation could still pass all existing tests while failing on those required amounts, so they need to be added before this work can be considered complete. To fix this, add explicit Jest tests in the existing getCoinCombination describe block that call getCoinCombination(6), getCoinCombination(17), and getCoinCombination(50) and assert the exact arrays described above. As a further improvement (not blocking), you could add tests for invalid inputs (negative numbers or non-integers) and explicit checks on the return shape, for example using expect(Array.isArray(result)).toBe(true) and expect(result).toHaveLength(4). Your current tests are well-structured and already verify several core scenarios, so with these additional cases you’ll have a much more complete and robust test suite.
✨ 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
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved because the getCoinCombination tests now fully exercise the required behavior and all examples produce the correct outputs. You correctly cover the important edge amounts like 6, 17, and 50 cents and assert the exact arrays in the required [pennies, nickels, dimes, quarters] order, along with basic cases such as 0, 1, 5, 10, 25, and 41 cents. The tests align with the exported function name and verify that the function returns the minimal number of coins for the tested inputs, so there are no blocking issues left.
As optional improvements, you could add tests for invalid inputs (e.g., negative numbers or non-integers) to more clearly define and enforce how the function should behave in those scenarios. It would also be a nice polish to fix small wording issues in your test descriptions (for example, changing “penni” to “penny”) and, if you’d like stricter checks, assert that each element in the returned array is a non-negative integer. Overall, this is a solid and thorough test file that meets the task requirements well.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.