test(ensemble): cover Page header storage listener dispose cleanup#2240
Draft
cursor[bot] wants to merge 1 commit into
Draft
test(ensemble): cover Page header storage listener dispose cleanup#2240cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Add widget tests for the PageState fix that dedupes storage event listeners and cancels periodic header poll timers on dispose. Covers reactive titleBarHeight/collapsibleHeader updates while mounted and verifies disposed pages do not throw when storage changes continue. Co-authored-by: Sharjeel Yunus <sharjeelyunus@users.noreply.github.com>
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
Adds widget tests for the
PageStatefix in2c45e427that deduped storage event listeners and cancelled periodic header poll timers on dispose.Risky behavior now covered
titleBarHeightupdates: Verifies AppBar height reacts whenensemble.storage.headerHeightchanges while the page is mounted (poll fallback path).ensemble.storage.headerVisiblebecomes false.Test files added/updated
modules/ensemble/test/widget/page_header_storage_listeners_test.dart(new, 4 tests)Why these tests materially reduce regression risk
The original bug registered duplicate
ModelChangeEventlisteners and leaked periodic timers, which could cause redundant rebuilds, memory leaks, andsetState()after dispose. These tests exercise the header storage integration paths that previously had zero coverage and assert both live reactivity and clean teardown — the two failure modes that motivated the production fix.Validation
All 4 tests pass. Tests mock
path_providerforGetStorageand are deterministic/independent.