yihong1120 / traffic_report_front_flutter

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 home_map.dart #88

Closed sweep-ai[bot] closed 10 months ago

sweep-ai[bot] commented 10 months ago

PR Feedback (click)

Summary of Changes

Please review and merge this PR to ensure the correctness of the new code and maintain code quality.

sweep-ai[bot] commented 10 months ago

Rollback Files For Sweep

sweep-ai[bot] commented 10 months ago
Sweeping Fixing PR: track the progress here.

I'm currently fixing this PR to address the following:

[Sweep GHA Fix] The GitHub Actions run failed with the following error logs: ``` The command: Run dart analyze yielded the following error: ##[error]Process completed with exit code 3. Here are the logs: Analyzing traffic_report_front_flutter... error - lib/screens/map/home_map.dart:2:8 - Target of URI doesn't exist: 'package:mockito/mockito.dart'. Try creating the file referenced by the URI, or try using a URI for a file that does exist. - uri_does_not_exist error - lib/screens/map/home_map.dart:14:9 - The unnamed constructor is already defined. Try giving one of the constructors a name. - duplicate_constructor error - lib/screens/map/home_map.dart:20:31 - Classes can only extend other classes. Try specifying a different superclass, or removing the extends clause. - extends_non_class error - lib/screens/map/home_map.dart:21:3 - 'testWidgets' must have a method body because 'HomeMapPageTest' isn't abstract. Try making 'HomeMapPageTest' abstract, or adding a body to 'testWidgets'. - concrete_class_with_abstract_member error - lib/screens/map/home_map.dart:21:15 - Expected an identifier. - missing_identifier error - lib/screens/map/home_map.dart:21:32 - Expected an identifier. - missing_identifier error - lib/screens/map/home_map.dart:21:41 - Expected to find ')'. - expected_token error - lib/screens/map/home_map.dart:25:3 - The name 'testWidgets' is already defined. Try renaming one of the declarations. - duplicate_definition - The first definition of this name at lib/screens/map/home_map.dart:21:3. error - lib/screens/map/home_map.dart:25:15 - Expected an identifier. - missing_identifier error - lib/screens/map/home_map.dart:25:30 - Expected an identifier. - missing_identifier error - lib/screens/map/home_map.dart:25:39 - Expected to find ')'. - expected_token error - lib/screens/map/home_map.dart:29:3 - The name 'testWidgets' is already defined. Try renaming one of the declarations. - duplicate_definition - The first definition of this name at lib/screens/map/home_map.dart:21:3. error - lib/screens/map/home_map.dart:29:15 - Expected an identifier. - missing_identifier error - lib/screens/map/home_map.dart:29:36 - Expected an identifier. - missing_identifier error - lib/screens/map/home_map.dart:29:45 - Expected to find ')'. - expected_token error - test/screens/map/home_map_test.dart:12:26 - Undefined name 'Drawer'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:13:26 - Undefined name 'GoogleMap'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:14:26 - Undefined name 'TextField'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:15:26 - Undefined name 'DropdownButton'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:23:42 - Undefined name 'TextField'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:26:36 - Undefined name 'Icons'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:30:14 - Undefined name '_searchKeyword'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:31:14 - Undefined name '_markers'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:39:36 - Undefined name 'DropdownButton'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:47:14 - Undefined name '_selectedTimeRange'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:48:14 - Undefined name '_selectedDateRange'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier warning - lib/screens/map/home_map.dart:4:8 - Unused import: 'dart:convert'. Try removing the import directive. - unused_import warning - lib/screens/map/home_map.dart:8:8 - Unused import: 'package:http/http.dart'. Try removing the import directive. - unused_import info - lib/components/media_picker.dart:16:18 - Don't use 'BuildContext's across async gaps. Try rewriting the code to not reference the 'BuildContext'. - use_build_context_synchronously info - lib/screens/map/home_map.dart:1:8 - The imported package 'flutter_test' isn't a dependency of the importing package. Try adding a dependency for 'flutter_test' in the 'pubspec.yaml' file. - depend_on_referenced_packages info - lib/screens/map/home_map.dart:2:8 - The imported package 'mockito' isn't a dependency of the importing package. Try adding a dependency for 'mockito' in the 'pubspec.yaml' file. - depend_on_referenced_packages info - lib/screens/map/home_map.dart:13:9 - Convert 'key' to a super parameter. - use_super_parameters info - lib/screens/map/home_map.dart:21:32 - Use the generic function type syntax to declare the parameter ''. Try using the generic function type syntax. - use_function_type_syntax_for_parameters info - lib/screens/map/home_map.dart:25:30 - Use the generic function type syntax to declare the parameter ''. Try using the generic function type syntax. - use_function_type_syntax_for_parameters info - lib/screens/map/home_map.dart:29:36 - Use the generic function type syntax to declare the parameter ''. Try using the generic function type syntax. - use_function_type_syntax_for_parameters info - lib/screens/map/home_map.dart:35:3 - Invalid use of a private type in a public API. Try making the private type public, or making the API that uses the private type also be private. - library_private_types_in_public_api info - test/screens/map/home_map_test.dart:8:31 - Use 'const' with the constructor to improve performance. Try adding the 'const' keyword to the constructor invocation. - prefer_const_constructors info - test/screens/map/home_map_test.dart:20:31 - Use 'const' with the constructor to improve performance. Try adding the 'const' keyword to the constructor invocation. - prefer_const_constructors info - test/screens/map/home_map_test.dart:36:31 - Use 'const' with the constructor to improve performance. Try adding the 'const' keyword to the constructor invocation. - prefer_const_constructors 39 issues found. ```

Created Pull Request: https://github.com/yihong1120/traffic_report_front_flutter/pull/89

sweep-ai[bot] commented 10 months ago
Sweeping Fixing PR: track the progress here.

I'm currently fixing this PR to address the following:

[Sweep GHA Fix] The GitHub Actions run failed with the following error logs: ``` The command: Run dart analyze yielded the following error: ##[error]Process completed with exit code 3. Here are the logs: Analyzing traffic_report_front_flutter... error - lib/screens/map/home_map.dart:2:8 - Target of URI doesn't exist: 'package:mockito/mockito.dart'. Try creating the file referenced by the URI, or try using a URI for a file that does exist. - uri_does_not_exist error - lib/screens/map/home_map.dart:14:9 - The unnamed constructor is already defined. Try giving one of the constructors a name. - duplicate_constructor error - lib/screens/map/home_map.dart:20:31 - Classes can only extend other classes. Try specifying a different superclass, or removing the extends clause. - extends_non_class error - lib/screens/map/home_map.dart:21:3 - 'testWidgets' must have a method body because 'HomeMapPageTest' isn't abstract. Try making 'HomeMapPageTest' abstract, or adding a body to 'testWidgets'. - concrete_class_with_abstract_member error - lib/screens/map/home_map.dart:21:15 - Expected an identifier. - missing_identifier error - lib/screens/map/home_map.dart:21:32 - Expected an identifier. - missing_identifier error - lib/screens/map/home_map.dart:21:41 - Expected to find ')'. - expected_token error - lib/screens/map/home_map.dart:25:3 - The name 'testWidgets' is already defined. Try renaming one of the declarations. - duplicate_definition - The first definition of this name at lib/screens/map/home_map.dart:21:3. error - lib/screens/map/home_map.dart:25:15 - Expected an identifier. - missing_identifier error - lib/screens/map/home_map.dart:25:30 - Expected an identifier. - missing_identifier error - lib/screens/map/home_map.dart:25:39 - Expected to find ')'. - expected_token error - lib/screens/map/home_map.dart:29:3 - The name 'testWidgets' is already defined. Try renaming one of the declarations. - duplicate_definition - The first definition of this name at lib/screens/map/home_map.dart:21:3. error - lib/screens/map/home_map.dart:29:15 - Expected an identifier. - missing_identifier error - lib/screens/map/home_map.dart:29:36 - Expected an identifier. - missing_identifier error - lib/screens/map/home_map.dart:29:45 - Expected to find ')'. - expected_token error - test/screens/map/home_map_test.dart:12:26 - Undefined name 'Drawer'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:13:26 - Undefined name 'GoogleMap'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:14:26 - Undefined name 'TextField'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:15:26 - Undefined name 'DropdownButton'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:23:42 - Undefined name 'TextField'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:26:36 - Undefined name 'Icons'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:30:14 - Undefined name '_searchKeyword'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:31:14 - Undefined name '_markers'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:39:36 - Undefined name 'DropdownButton'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:47:14 - Undefined name '_selectedTimeRange'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:48:14 - Undefined name '_selectedDateRange'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier info - lib/components/media_picker.dart:16:18 - Don't use 'BuildContext's across async gaps. Try rewriting the code to not reference the 'BuildContext'. - use_build_context_synchronously info - lib/screens/map/home_map.dart:1:8 - The imported package 'flutter_test' isn't a dependency of the importing package. Try adding a dependency for 'flutter_test' in the 'pubspec.yaml' file. - depend_on_referenced_packages info - lib/screens/map/home_map.dart:2:8 - The imported package 'mockito' isn't a dependency of the importing package. Try adding a dependency for 'mockito' in the 'pubspec.yaml' file. - depend_on_referenced_packages info - lib/screens/map/home_map.dart:13:9 - Convert 'key' to a super parameter. - use_super_parameters info - lib/screens/map/home_map.dart:21:32 - Use the generic function type syntax to declare the parameter ''. Try using the generic function type syntax. - use_function_type_syntax_for_parameters info - lib/screens/map/home_map.dart:25:30 - Use the generic function type syntax to declare the parameter ''. Try using the generic function type syntax. - use_function_type_syntax_for_parameters info - lib/screens/map/home_map.dart:29:36 - Use the generic function type syntax to declare the parameter ''. Try using the generic function type syntax. - use_function_type_syntax_for_parameters info - lib/screens/map/home_map.dart:35:3 - Invalid use of a private type in a public API. Try making the private type public, or making the API that uses the private type also be private. - library_private_types_in_public_api info - test/screens/map/home_map_test.dart:8:31 - Use 'const' with the constructor to improve performance. Try adding the 'const' keyword to the constructor invocation. - prefer_const_constructors info - test/screens/map/home_map_test.dart:20:31 - Use 'const' with the constructor to improve performance. Try adding the 'const' keyword to the constructor invocation. - prefer_const_constructors info - test/screens/map/home_map_test.dart:36:31 - Use 'const' with the constructor to improve performance. Try adding the 'const' keyword to the constructor invocation. - prefer_const_constructors 37 issues found. ```

Created Pull Request: https://github.com/yihong1120/traffic_report_front_flutter/pull/90

codeautopilot[bot] commented 10 months ago

PR summary

The Pull Request introduces unit tests for new business logic in the home_map.dart file, ensuring that the new code is tested and adheres to the rule that all new business logic should have corresponding unit tests. The PR adds a new test file home_map_test.dart and modifies the home_map.dart file to make it testable. The tests cover initial state verification, search functionality, and date range selection within the HomeMapPage widget.

Suggestion

sweep-ai[bot] commented 10 months ago
Sweeping Fixing PR: track the progress here.

I'm currently fixing this PR to address the following:

[Sweep GHA Fix] The GitHub Actions run failed with the following error logs: ``` The command: Run dart analyze yielded the following error: ##[error]Process completed with exit code 3. Here are the logs: Analyzing traffic_report_front_flutter... error - lib/screens/map/home_map.dart:2:8 - Target of URI doesn't exist: 'package:mockito/mockito.dart'. Try creating the file referenced by the URI, or try using a URI for a file that does exist. - uri_does_not_exist error - lib/screens/map/home_map.dart:14:9 - The unnamed constructor is already defined. Try giving one of the constructors a name. - duplicate_constructor error - lib/screens/map/home_map.dart:20:31 - Classes can only extend other classes. Try specifying a different superclass, or removing the extends clause. - extends_non_class error - lib/screens/map/home_map.dart:21:3 - 'testWidgets' must have a method body because 'HomeMapPageTest' isn't abstract. Try making 'HomeMapPageTest' abstract, or adding a body to 'testWidgets'. - concrete_class_with_abstract_member error - lib/screens/map/home_map.dart:21:15 - Expected an identifier. - missing_identifier error - lib/screens/map/home_map.dart:21:32 - Expected an identifier. - missing_identifier error - lib/screens/map/home_map.dart:21:41 - Expected to find ')'. - expected_token error - lib/screens/map/home_map.dart:25:3 - The name 'testWidgets' is already defined. Try renaming one of the declarations. - duplicate_definition - The first definition of this name at lib/screens/map/home_map.dart:21:3. error - lib/screens/map/home_map.dart:25:15 - Expected an identifier. - missing_identifier error - lib/screens/map/home_map.dart:25:30 - Expected an identifier. - missing_identifier error - lib/screens/map/home_map.dart:25:39 - Expected to find ')'. - expected_token error - lib/screens/map/home_map.dart:29:3 - The name 'testWidgets' is already defined. Try renaming one of the declarations. - duplicate_definition - The first definition of this name at lib/screens/map/home_map.dart:21:3. error - lib/screens/map/home_map.dart:29:15 - Expected an identifier. - missing_identifier error - lib/screens/map/home_map.dart:29:36 - Expected an identifier. - missing_identifier error - lib/screens/map/home_map.dart:29:45 - Expected to find ')'. - expected_token error - test/screens/map/home_map_test.dart:12:26 - Undefined name 'Drawer'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:13:26 - Undefined name 'GoogleMap'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:14:26 - Undefined name 'TextField'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:15:26 - Undefined name 'DropdownButton'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:23:42 - Undefined name 'TextField'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:26:36 - Undefined name 'Icons'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:30:14 - Undefined name '_searchKeyword'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:31:14 - Undefined name '_markers'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:39:36 - Undefined name 'DropdownButton'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:47:14 - Undefined name '_selectedTimeRange'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier error - test/screens/map/home_map_test.dart:48:14 - Undefined name '_selectedDateRange'. Try correcting the name to one that is defined, or defining the name. - undefined_identifier info - lib/components/media_picker.dart:16:18 - Don't use 'BuildContext's across async gaps. Try rewriting the code to not reference the 'BuildContext'. - use_build_context_synchronously info - lib/screens/map/home_map.dart:1:8 - The imported package 'flutter_test' isn't a dependency of the importing package. Try adding a dependency for 'flutter_test' in the 'pubspec.yaml' file. - depend_on_referenced_packages info - lib/screens/map/home_map.dart:2:8 - The imported package 'mockito' isn't a dependency of the importing package. Try adding a dependency for 'mockito' in the 'pubspec.yaml' file. - depend_on_referenced_packages info - lib/screens/map/home_map.dart:13:9 - Convert 'key' to a super parameter. - use_super_parameters info - lib/screens/map/home_map.dart:21:32 - Use the generic function type syntax to declare the parameter ''. Try using the generic function type syntax. - use_function_type_syntax_for_parameters info - lib/screens/map/home_map.dart:25:30 - Use the generic function type syntax to declare the parameter ''. Try using the generic function type syntax. - use_function_type_syntax_for_parameters info - lib/screens/map/home_map.dart:29:36 - Use the generic function type syntax to declare the parameter ''. Try using the generic function type syntax. - use_function_type_syntax_for_parameters info - lib/screens/map/home_map.dart:35:3 - Invalid use of a private type in a public API. Try making the private type public, or making the API that uses the private type also be private. - library_private_types_in_public_api info - test/screens/map/home_map_test.dart:8:31 - Use 'const' with the constructor to improve performance. Try adding the 'const' keyword to the constructor invocation. - prefer_const_constructors info - test/screens/map/home_map_test.dart:20:31 - Use 'const' with the constructor to improve performance. Try adding the 'const' keyword to the constructor invocation. - prefer_const_constructors info - test/screens/map/home_map_test.dart:36:31 - Use 'const' with the constructor to improve performance. Try adding the 'const' keyword to the constructor invocation. - prefer_const_constructors 37 issues found. ```

Making changes according to plan... (step 3/3)