π§ͺ test: add edge case tests for AsyncButton controller disposal - #16
Conversation
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Co-authored-by: esenmx <43244505+esenmx@users.noreply.github.com>
Add `mountedController(tester)` and `isDisposed()` / `isNotDisposed()` checks (via `ChangeNotifier.debugAssertNotDisposed`) to test/_helpers.dart and use them everywhere instead of an `addListener` probe plus a `_SpyController` subclass. The existing test 'swapping from internal to external controller disposes internal and uses new' never asserted disposal on base β deleting the didUpdateWidget dispose branch survived the whole suite. It now captures the internal controller and asserts `isDisposed()`, making its name true. The redundant 'swapping external controllers does not dispose former external controller' test is folded into the existing a->b swap test as two explicit `isNotDisposed()` assertions, so a regression fails at an assertion rather than in `newController()`'s teardown double-dispose. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
9db61a5 to
bd4004f
Compare
π― What: The testing gap addressed: Missing test cases for internal controller disposal vs external controller non-disposal in
AsyncButton.π Coverage:
AsyncButtonwith an internal controller disposes the controller.AsyncButtonwith an external controller preserves the controller without disposing it.β¨ Result: The improvement in test coverage guarantees proper lifecycle handling and prevents memory leaks or premature controller disposal.
PR created automatically by Jules for task 11667479156420786077 started by @esenmx