[Sweep Rules] Add Unit Tests for New Business Logic in Report Service #124
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Feedback (click)
I created this PR to address this rule:
"All new business logic should have corresponding unit tests."
Description
This PR adds unit tests for the new business logic introduced in the
getReports
method of thelib/services/report_service.dart
file. ThegetReports
method retrieves traffic violation reports and returns a list ofTrafficViolation
objects. The unit tests ensure the correctness of this method by testing different scenarios, including successful retrieval of reports and handling of error responses.Summary of Changes
test/services/report_service_test.dart
to add unit tests for thegetReports
method.test/services/report_service_test.dart
file to import necessary classes and functions from thelib/services/report_service.dart
file.getReports
method to verify the functionality of retrieving reports and mapping them toTrafficViolation
objects.getReports
method.getViolation
method to verify the functionality of retrieving a specific traffic violation report.getViolation
method.These changes ensure that the new business logic in the
getReports
method is thoroughly tested and that the codebase maintains a high level of test coverage.Please review and merge this PR once the tests pass successfully.
Thank you!