feat(predict): Adds scoreboard component#24528
Conversation
app/components/UI/Predict/components/PredictSportScoreboard/PredictSportScoreboard.test.tsx
Show resolved
Hide resolved
app/components/UI/Predict/components/PredictSportScoreboard/PredictSportScoreboard.test.tsx
Outdated
Show resolved
Hide resolved
app/components/UI/Predict/components/PredictSportWinner/PredictSportWinner.test.tsx
Show resolved
Hide resolved
app/components/UI/Predict/components/PredictSportScoreboard/PredictSportScoreboard.types.ts
Outdated
Show resolved
Hide resolved
…sk/metamask-mobile into predict/nfl-ui-primitives
…ard and updates localization
…/MetaMask/metamask-mobile into predict/nfl-scoreboard-component
app/components/UI/Predict/components/PredictSportTeamGradient/PredictSportTeamGradient.tsx
Show resolved
Hide resolved
…to predict/nfl-scoreboard-component
| expect(svg.props.viewBox).toBe('0 0 16 16'); | ||
| }); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Missing test for undefined color fallback behavior
Low Severity · Bugbot Rules
The PredictSportWinner component has a fallback for when color is undefined (color ?? colors.text.alternative), but every test passes a color prop. There is no test verifying the component renders correctly when color is omitted and uses the theme's alternative text color. This violates the unit testing guideline: "EVERY component MUST test: ✅ Edge cases - null, undefined, empty values".
app/components/UI/Predict/components/PredictSportScoreboard/PredictSportScoreboard.test.tsx
Outdated
Show resolved
Hide resolved
app/components/UI/Predict/components/PredictSportWinner/PredictSportWinner.test.tsx
Show resolved
Hide resolved
PR #24528 Review SummaryPR: feat(predict): Adds scoreboard component OverviewThis PR adds a sports scoreboard component ( 🔴 Critical Issues (0)No critical issues found. 🟠 High Severity Issues (4)1. Tests Don't Mock External DependenciesLocation: 2. "Size Variants" Tests Reference Non-Existent PropLocation: // All three tests are identical - no actual variant prop exists
it('renders with default variant when variant prop omitted', () => ...);
it('renders with default variant when explicitly specified', () => ...);
it('renders with compact variant when specified', () => ...);Recommendation: Remove this entire test block or implement the actual variant functionality. 3. Test Names Violate GuidelinesLocation: // ❌ Violates guidelines
it.each([...])('handles %s possession state', ...)
it.each([...])('renders %s state successfully', ...)
it.each([...])('handles %s winner state', ...)Recommendation: Rename to explicit outcomes:
4. Parameterized Tests Are No-Op Smoke TestsLocation: 🟡 Medium Severity Issues (3)5. testID Creates "undefined-*" IDs When Prop MissingLocation: // Current - problematic
testID={`${testID}-away-helmet`}
// Recommended fix
testID={testID ? `${testID}-away-helmet` : undefined}Recommendation: Guard all child testIDs with conditional checks. 6. Score Defaulting to 0 May Be MisleadingLocation: 7. PredictSportWinner Tests Don't Mock useThemeLocation: 🟢 Low Severity Issues (4)8. Football Icon Test Name Now InaccurateLocation: 9. Enum Duplication (Possession & Winner)Location: 10. Team Parameter Typing Could Be CleanerLocation: 11. UNSAFE_getByType Usage in TestsLocation: ✅ Positive Observations
Summary by Severity
Recommended Actions Before Merge
Estimated Effort: 1-4 hours for test fixes and cleanup Verdict: The implementation code is solid and follows project conventions well. The main issues are in test quality - specifically redundant tests, guideline violations in test names, and missing mocks. Recommend addressing High severity items before merge. Review generated by AI code review agents (Oracle, Frontend-UI-UX, Code-Review) |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsThe changes are isolated to the Predict feature, adding new UI components (PredictSportScoreboard and PredictSportWinner) and making a minor color change to PredictSportFootballIcon. These are purely presentational components for displaying sports game information in the predictions feature. Key observations:
The SmokePredictions tag is the appropriate choice as it covers prediction market E2E tests. Running these tests will verify that the prediction feature continues to work correctly with the new sports-related UI components. |
|
matallui
left a comment
There was a problem hiding this comment.
Let's get this in and we can refactor as we integrate this with the data logic.



Description
This PR adds sports scoreboard component that hands the various potential game states (pre-game, in-progress, half-time, delayed, and final). When a game is in-progress a possession indicator can be displayed next to a provided team. Similarly, when a game is over and a winner is specified, a trophy icon displays next to the winning team's abbreviation.
What's included:
PredictSportScoreboardcomponentPredictSportScoreboard.types.tswithAway,Home, andNonevalues (mirrors the existing Possession enum pattern)PredictSportScoreboardto:Winner.None)Changelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
Add the following to a page wherein you want to view the scoreboard (note the various game states are provided below for reference):
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Introduces a reusable NFL-style scoreboard with clear game-state display and indicators for possession and final winner.
PredictSportScoreboardcomponent withPreGame,InProgress,Halftime,Finalstates, optionaleventTitle/date/time/quarter, and team helmets; shows scores except inPreGamePredictSportFootballIconduringInProgress; winner trophy viaPredictSportWinnerwhenFinalandwinnerspecifiedWinnerenum and props inPredictSportScoreboard.typespredict.sports.halftimeandpredict.sports.finalinlocales/languages/en.jsonPredictSportFootballIcondefault color tocolors.text.alternativePredictSportScoreboardandPredictSportWinnerWritten by Cursor Bugbot for commit a890b12. This will update automatically on new commits. Configure here.