Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add [Coderabbit] PR Stats service and tests (#10749)
* Add Coderabbit PR Stats service and tests - Implemented a new service `CoderabbitStats` to fetch and display pull request statistics from the CodeRabbit API. - Created a corresponding tester file to validate the service's functionality, including tests for valid repositories, repository not found, and server errors. - The service returns a badge with the number of PRs and appropriate error messages based on the API response. This addition enhances the analysis capabilities of the application by integrating CodeRabbit statistics. * Refactor CoderabbitStats service to track reviews instead of PRs - Updated the service to fetch and display the number of reviews from the CodeRabbit API, changing the schema and badge labels accordingly. - Modified the tester file to reflect the new endpoint and expected responses, including regex for message validation. - Enhanced error handling in the service to return more descriptive error messages for invalid repositories and server errors. This change improves the accuracy of the statistics provided by the service, aligning it with the intended functionality of tracking reviews. * Enhance CodeRabbitStats service and tests - Updated the CodeRabbitStats service to include OpenAPI documentation and improved error handling for repository not found scenarios. - Changed badge label from 'CodeRabbit' to 'CodeRabbit Reviews' for clarity. - Modified the tester file to reflect the new badge format and error messages, ensuring consistency with the service updates. - Adjusted regex patterns for message validation in tests. These changes improve the usability and accuracy of the CodeRabbit statistics service. * Update services/coderabbit/coderabbit-stats.tester.js Co-authored-by: jNullj <15849761+jNullj@users.noreply.github.com> * Addressed codereview comments, changed tests. * Fix label casing in CodeRabbitStats service and tests * Update services/coderabbit/coderabbit-stats.service.js Co-authored-by: chris48s <chris48s@users.noreply.github.com> * Update CodeRabbitStats service and tests to improve error messaging - Changed example section in CodeRabbitStats service from 'github, gitlab, bitbucket' to 'github' as per review comment. - Updated error message for 404 response to 'provider or repo not found', to reflect the right code. * Added github, gitlab, bitbucket to provider. * Changing names to match the service name, removing unneeded test. --------- Co-authored-by: jNullj <15849761+jNullj@users.noreply.github.com> Co-authored-by: chris48s <chris48s@users.noreply.github.com>
- Loading branch information