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

Refactor Tests to Use Public Methods for Private Function Coverage #8

Merged
merged 1 commit into from
May 31, 2024

Conversation

devin-ai-integration[bot]
Copy link
Contributor

Pull Request: Refactor Tests to Use Public Methods for Private Function Coverage

Summary

This pull request refactors the tests in the gitlabClient.test.ts file to use public methods for covering the private executeRequest function. The changes ensure that the error handling of the executeRequest method is adequately tested without violating the access restrictions of the class.

Changes Made

  • Refactored the test 'executeRequest logs error and rethrows on failure' to 'getProject logs error and rethrows on failure'.
  • The refactored test uses the getProject method, which internally calls executeRequest, to indirectly test the error handling of the private executeRequest method.

Reason for Changes

The original test directly called the private executeRequest method, resulting in an error due to access restrictions. The refactored test uses a public method to indirectly test the error handling, ensuring that the private method's functionality is covered without violating class access restrictions.

Link to Devin Run

Devin Run

Testing

  • Ran the test suite using npm test.
  • All tests passed successfully.
  • Code coverage is at 100% for statements, branches, functions, and lines.

Please review the changes and provide feedback.

Copy link

codecov bot commented May 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (91c0629) to head (61aed6d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main        #8      +/-   ##
===========================================
+ Coverage   94.94%   100.00%   +5.05%     
===========================================
  Files           5         5              
  Lines          99        99              
  Branches       14        14              
===========================================
+ Hits           94        99       +5     
+ Misses          5         0       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

sonarcloud bot commented May 31, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@devin-ai-integration devin-ai-integration bot merged commit 22646e1 into main May 31, 2024
6 checks passed
@devin-ai-integration devin-ai-integration bot deleted the new-refactor-tests branch May 31, 2024 08:26
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.

0 participants