-
Notifications
You must be signed in to change notification settings - Fork 40
[MOB-12186] add-tests-for-iterableutil #709
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
Conversation
…curate orientation detection
|
Diff Coverage: Not applicable. There was no coverage data reported for the files in this diff. Total Coverage: This PR will increase coverage by 1.18%. File Coverage Changes
🛟 Help
This is from Qlty Cloud, the successor to Code Climate Quality. Learn more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive test coverage for the IterableUtil class, specifically focusing on the readBoolean method. The tests document the current behavior where the method doesn't strictly validate boolean types but returns truthy values as-is and falsy values as false.
- Adds 15 test cases covering various scenarios including boolean values, falsy values, truthy non-boolean values, and edge cases
- Documents current implementation limitations through comments and TODO items
- Provides test coverage for key existence checks and case sensitivity
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| // THEN it should return the string cast to boolean (truthy) | ||
| expect(result).toBe('true'); |
Copilot
AI
Oct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment describes the string as being 'cast to boolean (truthy)' but the test expects the original string value 'true', not a boolean. The comment should clarify that truthy values are returned as-is, not cast to boolean.
| // WHEN reading the boolean value | ||
| const result = IterableUtil.readBoolean(dict, 'testKey'); | ||
|
|
||
| // THEN it should return the number cast to boolean (truthy) |
Copilot
AI
Oct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment describes the number as being 'cast to boolean (truthy)' but the test expects the original number value 1, not a boolean. The comment should clarify that truthy values are returned as-is, not cast to boolean.
| // THEN it should return the number cast to boolean (truthy) | |
| // THEN it should return the original number value (since it is truthy) |
| // THEN it should return the object cast to boolean (truthy) | ||
| expect(result).toEqual({}); |
Copilot
AI
Oct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment describes the object as being 'cast to boolean (truthy)' but the test expects the original object value, not a boolean. The comment should clarify that truthy values are returned as-is, not cast to boolean.
| // WHEN reading the boolean value | ||
| const result = IterableUtil.readBoolean(dict, 'testKey'); | ||
|
|
||
| // THEN it should return the array cast to boolean (truthy) |
Copilot
AI
Oct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment describes the array as being 'cast to boolean (truthy)' but the test expects the original array value, not a boolean. The comment should clarify that truthy values are returned as-is, not cast to boolean.
| // THEN it should return the array cast to boolean (truthy) | |
| // THEN it should return the array value as-is (since arrays are truthy) |
| // THEN it should return the function cast to boolean (truthy) | ||
| expect(result).toBeInstanceOf(Function); |
Copilot
AI
Oct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment describes the function as being 'cast to boolean (truthy)' but the test expects the original function value, not a boolean. The comment should clarify that truthy values are returned as-is, not cast to boolean.
Ayyanchira
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
🔹 JIRA Ticket(s) if any
✏️ Description
Adds tests for IterableUtil