-
Couldn't load subscription status.
- Fork 3.5k
[file_selector] Remove use of Pigeon's Dart test generator #10315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[file_selector] Remove use of Pigeon's Dart test generator #10315
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refactors the tests for file_selector_ios, file_selector_macos, and file_selector_windows to remove the dependency on Pigeon's Dart test generator and the mockito package. This is achieved by introducing dependency injection for the platform-specific FileSelectorApi and using a simple fake implementation in tests. This change simplifies the test setup, reduces dependencies, and removes generated test files, improving the overall maintainability of the codebase. The changes are consistent across all affected packages and I've noted one opportunity for improvement.
|
CHANGELOG/version overrides: While technically there is production code change here, it's just adding an optional, visibible-only-for-tests parameter, and moving one ivar initialization from the declaration to the constructor, so it's pretty clearly a no-op. |
| final bool? selectMultiple; | ||
| } | ||
|
|
||
| @HostApi(dartHostTestHandler: 'TestFileSelectorApi') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn't being used, it was just copypasta from some other platform, which is why there are no other changes to file_selector_linux.
Updates
file_selector_ios,_macos, and_windowstests to use the same structure asfile_selector_linuxalready uses:mockitoin favor of a fake, since the fake is extremely simple to maintain and it makes the tests simpler.Part of flutter/flutter#159886
Pre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3