test(ensemble): cover navigateViewGroup clamp, CDN stale refresh, storage clear#2266
Draft
cursor[bot] wants to merge 1 commit into
Draft
test(ensemble): cover navigateViewGroup clamp, CDN stale refresh, storage clear#2266cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
…rage clear Extract @VisibleForTesting helpers for recent regression fixes: - resolveNavigateViewGroupTabIndex (navigateViewGroup index clamping) - applyStaleRefreshOutcome (CDN race condition on cold start vs resume) - isCdnManifestIncomingNewer (CDN manifest freshness gating) - runEnsembleStorageClearDispatches (storage.clear binding ordering) Add focused unit tests that prove correctness without widget or network deps. 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.
Risky behavior now covered
navigateViewGroupindex clamping — PreventsPageController.jumpToPageassertions when script-providedviewIndexexceeds the tab range (regression from #0ce6723a).ensemble.storage.clear()dispatch ordering — Verifies binding notifications run only after async public storage removal completes, so listeners do not read stale values (regression from #8c2a52de).Test files added/updated
modules/ensemble/test/safe_view_group_payload_index_test.dartresolveNavigateViewGroupTabIndexcasesmodules/ensemble/test/cdn_provider_test.dartmodules/ensemble/test/cdn_manifest_freshness_test.dartisCdnManifestIncomingNewerunit testsmodules/ensemble/test/ensemble_storage_clear_dispatch_test.dartrunEnsembleStorageClearDispatchesordering testsWhy these tests materially reduce regression risk
These areas are high blast-radius core flows (navigation, CDN updates, storage bindings) that were fixed recently with production-only changes. The extracted
@visibleForTestinghelpers let us assert the exact decision logic in isolation — no widgets, network, or Workmanager — so future refactors cannot silently reintroduce out-of-range tab jumps, CDN refresh races, or premature storage binding dispatches.Validation
All 20 tests passed.