Repository navigation
test(app): add regression test for toggleApp failed-install branch - #10121
Conversation
|
Solid regression guard for the #10100 fix — the failure-path test is exactly the coverage that was requested, and the three cases (fail / succeed / disable) cleanly pin the Two small notes, neither blocking:
CI on this head looks green on the material checks (Flutter Tests, Dart Analyze ratchet, Generated Files, Android Compile Smoke, PR Preflight all pass). Left un-approved only because the test seams + dialog guard touch provider/dialog surfaces I want a human maintainer to eyeball before merge — happy to convert to an approval once that is confirmed. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
5116cbe to
1af99d8
Compare
|
Marked both override seams |
Follow-up to #10100 which changed toggleApp from Future<void> to Future<bool> routed the create-template sheet through it. The reviewer requested a test covering the failure path so the false-success regression cannot return silently. Adds a minimal test seam (enableAppOverride) to AppProvider to allow mocking enableAppServer without a mocking library. Test: app/test/providers/app_provider_toggle_test.dart - toggleApp returns false when enableAppServer fails - toggleApp returns true when enableAppServer succeeds
- Make AppDialog.show() safe when no navigator is mounted (globalNavigatorKey.currentState is null), preventing a crash on the failure path in tests and edge-case production scenarios. - Add disableAppOverride seam to AppProvider for symmetric testability. - Convert toggleApp tests from testWidgets to pure test() — no widget tree needed. Restructure: regression guard + success + disable path. - Add disable path test: confirms disableAppOverride is called and enableAppOverride is not.
68bd562 to
867ed2b
Compare
Git-on-my-level
left a comment
There was a problem hiding this comment.
Approved after independent gpt-5.6-terra review of the post-feedback source, rebase onto current main, and passing fresh Flutter CI: 921 tests, Dart Analyze, Generated Files, formatting, Android smoke, and hygiene.
Summary
Adds a regression test for the failed-install branch that PR #10100 fixed. The PR changed
toggleAppfromFuture<void>→Future<bool>and routed the create-template sheet through it. The reviewer requested a test covering the failure path so the false-success regression cannot silently return.Changes
app/lib/providers/app_provider.dart(+10/-3)Adds two minimal test seams:
enableAppOverrideenableAppServerin tests for the failed-install branchdisableAppOverridedisableAppServerfor the disable pathBoth fall through to the real functions when null — existing callers unaffected.
app/lib/utils/alerts/app_dialog.dart(+3/-1)Makes
AppDialog.show()null-safe: returns early when no navigator is mounted. Prevents a hard crash on the failure path in edge-case production scenarios and in tests without a widget tree.app/test/providers/app_provider_toggle_test.dart(new, ~85 lines)Three tests, all pure
test()(no widget tree needed):returns false when enableAppServer fails (regression guard)toggleAppmust surface failure to its callerreturns true when enableAppServer succeedsdoes not call enableAppOverride when disablingVerification
Existing provider tests also pass (no regressions):
pre-push checks: 10/10 passed.
Failure-Class: none