Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution #438

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Solution #438

wants to merge 1 commit into from

Conversation

Galers
Copy link

@Galers Galers commented Dec 9, 2024

Have a nice day!

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.

Great job on implementing the getCoinCombination function and its tests! 🎉 The code meets the task requirements and functions as expected. While there are some minor improvements suggested for test case naming and code simplification, these do not impact the functionality. Keep up the great work and consider the feedback for future enhancements! 😊

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

Comment on lines +13 to +15
if (isNaN(cents)) {
return coins;
}

Choose a reason for hiding this comment

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

The check for isNaN(cents) is redundant because the subsequent check for typeof cents !== 'number' will also handle non-numeric inputs. Consider removing the isNaN check to simplify the code.

Comment on lines +10 to +14
it(`should be positive number`, () => {
expect(getCoinCombination(0)).toEqual([0, 0, 0, 0]);
expect(getCoinCombination(6)).toEqual([1, 1, 0, 0]);
expect(getCoinCombination(17)).toEqual([2, 1, 1, 0]);
});

Choose a reason for hiding this comment

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

The description 'should be positive number' is misleading because the test is checking the function's output for various valid inputs, not just positive numbers. Consider renaming it to something like 'should return correct coin combination for valid inputs'.

Comment on lines +16 to +20
it(`should be limit values`, () => {
expect(getCoinCombination(50)).toEqual([0, 0, 0, 2]);
expect(getCoinCombination(26)).toEqual([1, 0, 0, 1]);
expect(getCoinCombination(33)).toEqual([3, 1, 0, 1]);
});

Choose a reason for hiding this comment

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

The description 'should be limit values' could be more descriptive. Consider renaming it to 'should handle edge cases correctly' to better reflect the purpose of these tests.

Comment on lines +43 to 48
it(`should be integer`, () => {
expect(getCoinCombination("1")).toEqual([0, 0, 0, 0]);
expect(getCoinCombination(0)).toEqual([0, 0, 0, 0]);
expect(getCoinCombination(NaN)).toEqual([0, 0, 0, 0]);
expect(getCoinCombination(null)).toEqual([0, 0, 0, 0]);
});

Choose a reason for hiding this comment

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

The description 'should be integer' might be confusing as the test is checking how the function handles non-integer inputs. Consider renaming it to 'should handle non-integer inputs gracefully'.

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