test: add tests for usage component#1900
Conversation
|
What reviewer looks at during PR reviewThe following are ideal points maintainers look for during review. Reviewing these points yourself beforehand can help streamline the review process and reduce time to merge.
|
|
Related Documentation No published documentation to review for changes on this repository. |
📝 WalkthroughWalkthroughAdds a new test suite for the Usage component with 99 lines of test coverage, including snapshot tests for two supported languages (python, javascript) and comprehensive error validation for invalid language parameter inputs. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Important Action Needed: IP Allowlist UpdateIf your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:
Failure to add the new IP will result in interrupted reviews. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@Adi-204 I think CI failures are occurring in |
|
@batchu5 , go through once the failing checks shown by codebbit ai |
|
Thanks for the suggestion @SHUBHANSHU602, but I have added the docstrings in this PR. So I think there is no need to add them here, if it gets merged this checks will pass. |
| if (!language || typeof language !== 'string') { | ||
| throw new Error(`Invalid "language" parameter: must be a non-empty string, received ${language}`); | ||
| } | ||
|
|
||
| const snippetFn = usageConfig[language]; | ||
|
|
||
| if (!snippetFn) { | ||
| throw new Error( | ||
| `Invalid "language" parameter: unsupported value "${language}"` | ||
| ); | ||
| } | ||
|
|
There was a problem hiding this comment.
no need to add error handling for now we already have a separate issue, revert this changes.
| 'Invalid "language" parameter: must be a non-empty string, received undefined' | ||
| ); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Also remove testcases of error handling.
|
|
/rtm |



Summary
Improve validation and test coverage for the Usage component.
What changed
Related issue(s)
Fixes #1868
Summary by CodeRabbit