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 #116
"All new business logic should have corresponding unit tests."
Description
This PR adds unit tests for the new business logic in the following files:
lib/components/search_bar.dart
lib/components/time_range_dropdown.dart
lib/services/map_service.dart (new method: getTrafficViolationDetails)
lib/utils/date_time_utils.dart
The unit tests cover all possible scenarios and edge cases to ensure the correctness of the new code.
Summary of Changes
Added unit tests for the SearchBar component in lib/components/search_bar.dart. The tests verify the onChanged callback is called when the text in the TextField changes and the onPressed callback is called when the IconButton is pressed.
Added unit tests for the TimeRangeDropdown component in lib/components/time_range_dropdown.dart. The tests verify the onTimeRangeChanged callback is called when the selected value changes.
Added unit tests for the getTrafficViolationDetails method in lib/services/map_service.dart. The tests mock the HTTP request and verify that the correct data is returned.
Added unit tests for the formatTimeOfDay function in lib/utils/date_time_utils.dart. The tests verify the correct formatted string is returned for different TimeOfDay values.
Please review and merge this PR to ensure the new business logic is thoroughly tested.
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 following files:
The unit tests cover all possible scenarios and edge cases to ensure the correctness of the new code.
Summary of Changes
Please review and merge this PR to ensure the new business logic is thoroughly tested.