A platform, 'Traffic-Violation-Report-System', enabling users in Taiwan to upload and share responses from law enforcement to traffic violations. This system aims for greater transparency in traffic law enforcement. It utilises Django for backend and Flutter for a separated frontend web development.
GNU Affero General Public License v3.0
0
stars
0
forks
source link
[Sweep Rules] Add unit tests for new business logic in report_service_test.dart #125
"All new business logic should have corresponding unit tests."
Description
This PR adds unit tests for the new business logic in the report_service_test.dart file. The code diff in the file introduced new fields (address, officer, and mediaFiles) to the TrafficViolation object, but the corresponding unit tests were missing. This PR addresses the issue by adding comprehensive unit tests to cover these new fields and their functionality.
Summary of Changes
Updated the getViolation test case in report_service_test.dart to include assertions for the new fields (address, officer, and mediaFiles).
Added assertions to verify that the returned TrafficViolation object has the correct values for these fields.
Added appropriate test data to cover different scenarios and edge cases.
Updated the updateReport test case in report_service_test.dart to include assertions for the new fields (address, officer, and mediaFiles).
Added assertions to verify that the updateReport method returns true when the HTTP call completes successfully.
Added appropriate test data to cover different scenarios and edge cases, including cases with local and remote media files.
These changes ensure that the new business logic in the report_service_test.dart file is thoroughly tested and that the unit tests cover all possible scenarios and edge cases.
Please review and merge this PR to ensure code coverage and maintain test integrity.
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 in the
report_service_test.dart
file. The code diff in the file introduced new fields (address
,officer
, andmediaFiles
) to theTrafficViolation
object, but the corresponding unit tests were missing. This PR addresses the issue by adding comprehensive unit tests to cover these new fields and their functionality.Summary of Changes
Updated the
getViolation
test case inreport_service_test.dart
to include assertions for the new fields (address
,officer
, andmediaFiles
).Added assertions to verify that the returned
TrafficViolation
object has the correct values for these fields.Added appropriate test data to cover different scenarios and edge cases.
Updated the
updateReport
test case inreport_service_test.dart
to include assertions for the new fields (address
,officer
, andmediaFiles
).Added assertions to verify that the
updateReport
method returnstrue
when the HTTP call completes successfully.Added appropriate test data to cover different scenarios and edge cases, including cases with local and remote media files.
These changes ensure that the new business logic in the
report_service_test.dart
file is thoroughly tested and that the unit tests cover all possible scenarios and edge cases.Please review and merge this PR to ensure code coverage and maintain test integrity.