Skip to content

fix: provide AppSettingsService in tcp_flow_test#301

Merged
zjs81 merged 2 commits into
zjs81:mainfrom
just-stuff-tm:fix/tcp-flow-test-missing-provider
Mar 16, 2026
Merged

fix: provide AppSettingsService in tcp_flow_test#301
zjs81 merged 2 commits into
zjs81:mainfrom
just-stuff-tm:fix/tcp-flow-test-missing-provider

Conversation

@just-stuff-tm

Copy link
Copy Markdown
Contributor

Problem

tcp_flow_test.dart fails with ProviderNotFoundException for AppSettingsService because the test helper _buildTestApp only wraps the widget tree with ChangeNotifierProvider<MeshCoreConnector>.

TcpScreen.initState calls context.read<AppSettingsService>() to pre-fill the host/port text fields from saved settings, which throws when no provider is in the tree.

Fix

Switch _buildTestApp from a single ChangeNotifierProvider to a MultiProvider that also provides AppSettingsService (default constructor — no saved settings needed for tests).

All 5 tcp_flow_test cases and the full 93-test suite pass.

TcpScreen.initState reads AppSettingsService from context
to pre-fill host/port fields, but the test helper only
provided MeshCoreConnector. Switch to MultiProvider so
AppSettingsService is also in the widget tree.
Copilot AI review requested due to automatic review settings March 15, 2026 20:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the TCP flow widget tests to provide AppSettingsService in the widget tree, matching the runtime dependency expectations of TcpScreen/related screens.

Changes:

  • Add AppSettingsService import to the TCP flow test.
  • Wrap the test MaterialApp in a MultiProvider and register both MeshCoreConnector and AppSettingsService.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zjs81 zjs81 merged commit 53caec3 into zjs81:main Mar 16, 2026
6 checks passed
@just-stuff-tm just-stuff-tm deleted the fix/tcp-flow-test-missing-provider branch March 16, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants