-
Notifications
You must be signed in to change notification settings - Fork 5.4k
fix: Update dapp swap comparison banner copy if rewards doesnt exist #38317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✨ Files requiring CODEOWNER review ✨✅ @MetaMask/confirmations (2 files, +3 -2)
|
| }); | ||
| const { getByText } = render(); | ||
| expect(getByText(/Earn 100 points/u)).toBeInTheDocument(); | ||
| expect(getByText('Save and earn with MetaMask Swaps')).toBeInTheDocument(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Test missing mock setup prevents component from rendering
The new test 'renders rewards text when it is provided' mocks useDappSwapComparisonRewardText to return rewards data, but doesn't mock useDappSwapComparisonInfo with a selectedQuoteValueDifference value. The default mock only provides selectedQuote, so selectedQuoteValueDifference is undefined. The component's render condition requires selectedQuoteValueDifference >= 0.01, which fails for undefined, causing the component to not render. The test assertions checking for "Save and earn with MetaMask Swaps" will fail.
Builds ready [31dea0b]
UI Startup Metrics (1234 ± 135 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
This PR updates dapp swap comparison banner copy if rewards does not exists.
Note: No changelog needed as this feature not released yet.
Changelog
CHANGELOG entry: null
Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/6349
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Shows "Save with MetaMask Swaps" when rewards are absent, adding i18n keys and updating tests accordingly.
dapp-swap-comparison-banner.tsxto rendert('dappSwapAdvantage')only whenrewardsexist; otherwise uset('dappSwapAdvantageSaveOnly').dappSwapAdvantageSaveOnlylocale string inapp/_locales/en/messages.jsonandapp/_locales/en_GB/messages.json.dapp-swap-comparison-banner.test.tsxto check for "Save with MetaMask Swaps" without rewards and "Save and earn with MetaMask Swaps" when rewards are provided.Written by Cursor Bugbot for commit 31dea0b. This will update automatically on new commits. Configure here.