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

Add [Coderabbit] PR Stats service and tests #10749

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

Conversation

aravindputrevu
Copy link

@aravindputrevu aravindputrevu commented Dec 16, 2024

  • 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.

GitHub Issue - #10748

- 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.
Copy link
Contributor

Messages
📖 ✨ Thanks for your contribution to Shields, @aravindputrevu!

Generated by 🚫 dangerJS against 1dbee22

@chris48s chris48s changed the title Add Coderabbit PR Stats service and tests Add [Coderabbit] PR Stats service and tests Dec 16, 2024
@chris48s chris48s added the service-badge New or updated service badge label Dec 16, 2024
Copy link
Contributor

@jNullj jNullj left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution.
I noticed you did not add any live tests (making real API calls to external service) and only mocked responses.
Please give a quick read to this section of our docs about tests, as mentioned its best to include at least one live test so we know our service is still live and up to date with upstream.

Note that when we call our badge, we are allowing it to communicate with an external service without mocking the response. We write tests which interact with external services, which is unusual practice in unit testing. We do this because one of the purposes of service tests is to notify us if a badge has broken due to an upstream API change. For this reason it is important for at least one test to call the live API without mocking the interaction

Is there a specific reason to avoid using live tests? If no could you add at least one live test, Its common for our project to have all calls to live services in tests unless we test internal functionality like data transformation of API response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-badge New or updated service badge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants