Add unit-test coverage for ChampionsCard pager composition
Categories
(Firefox for Android :: Homepage, task)
Tracking
()
People
(Reporter: skhan, Assigned: skhan)
References
Details
Attachments
(1 obsolete file)
The pager-composition path that turns a MatchCard with FollowedTeamOutcome.TournamentWinner / ThirdPlace into a ChampionsCard page has no test coverage. Three pieces of logic landed in Bug 2040620
(https://bugzilla.mozilla.org/show_bug.cgi?id=2040620) with no automated guard:
- shouldDisplayChampionsCard(viewerOutcome) — the private predicate at mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/sports/ui/SportsWidget.kt:255-260 that decides "this MatchCard should render
as a ChampionsCard page". - The championsPageIndices.add(size) accumulator in sportsCardPages() (same file) — what tells SportsCardPager which pages are champion pages, so it can suppress the overflow menu and background chrome.
- The actual selection of ChampionsCard vs MatchCard in the matchCardStates.forEach loop of sportsCardPages().
If any of these regress (e.g. someone makes shouldDisplayChampionsCard return false always, or flips the index bookkeeping), the existing test suite stays green and only manual smoke-testing during World Cup will
catch it.
Promotes sportsCardPages and shouldDisplayChampionsCard from private to internal
so the pager-composition logic introduced in Bug 2040620 can be exercised by
unit tests without a Compose harness.
The page-builder lambdas are constructed but never invoked — the new tests only
inspect the returned page-count and championsPageIndices set, which guards
against regressions of:
- the shouldDisplayChampionsCard predicate (which celebration outcomes opt
into the ChampionsCard rendering), - the championsPageIndices.add(size) accumulator in sportsCardPages (correct
when promo / following cards shift the match-card indices).
Updated•5 months ago
|
Updated•5 months ago
|
Description
•