feat(tests): add comprehensive unit/widget tests and fix deprecations#9
Merged
feat(tests): add comprehensive unit/widget tests and fix deprecations#9
Conversation
- Add test/exceptions_test.dart covering all four exception classes - Add test/models_test.dart covering model copyWith, toJson, and enums - Add test/platform_interface_test.dart verifying all abstract methods throw UnimplementedError - Add test/with_foreground_task_test.dart as a widget test for WithForegroundTask - Expand test/method_channel_test.dart and test/task_handler_test.dart for full branch coverage - Replace deprecated WillPopScope with PopScope in lib/ui/with_foreground_task.dart - Fix deprecated Color.red/green/blue getters in lib/utils/color_extension.dart - Refactor else-if chains into independent if blocks in lib/flutter_foreground_task_controller.dart and lib/models/service_options.dart - Add flutter analyze step to .github/workflows/unit-test.yml
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.




Summary
exceptions_test.dart,models_test.dart,platform_interface_test.dart,with_foreground_task_test.dart,method_channel_test.dart— collectively covering exception classes, modelcopyWith/toJson, allFlutterForegroundTaskPlatformabstract methods, theWithForegroundTaskwidget, and the method channel layer.task_handler_test.dartnow includes aMinimalTaskHandlerthat exercises the default no-op bodies of the optionalTaskHandlercallbacks.WillPopScopedeprecation: replaced withPopScope+onPopInvokedWithResultinlib/ui/with_foreground_task.dart; app minimizes when service is running, exits viaSystemNavigator.pop()otherwise.Colorgetters:lib/utils/color_extension.dartnow uses(r/g/b * 255.0).round().clamp(0, 255)instead of the removed.red/.green/.blueproperties.else ifchains: converted to independentifblocks insaveData(flutter_foreground_task_controller.dart) and platform-conditional serialisation (service_options.dart).flutter analyzestep to.github/workflows/unit-test.ymlso analysis failures block the build.Test plan
flutter analyzereports no issuesflutter test --coveragepasses with all new tests greenlib/ui/with_foreground_task.dart,lib/utils/color_extension.dart,lib/errors/*.dart,lib/models/*.dart, andlib/flutter_foreground_task_platform_interface.dartis at or near 100 %