Open Bug 2042543 Opened 5 months ago Updated 5 months ago

Add unit-test coverage for ChampionsCard pager composition

Categories

(Firefox for Android :: Homepage, task)

All
Android
task

Tracking

()

ASSIGNED

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:

  1. 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".
  2. 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.
  3. 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).
Assignee: nobody → skhan
Status: NEW → ASSIGNED
Attachment #9589930 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: