Commit 341cbba
test: use mockTheme instead of hardcoded hex values in test assertions (#26657)
## **Description**
This PR updates test files to use design token references instead of
hardcoded hex values, unblocking the design tokens upgrade to v8.2.1
(#26639).
**What this PR does:**
- Replaces hardcoded color hex values with `mockTheme.colors.*`
references in test assertions
- Uses `brandColor.*` for static, non-theme-dependent colors (camera
overlay)
- Updates snapshots to reflect new design token values
- Fixes template interpolation in inline snapshots
**Why this is an improvement:**
- Makes tests resilient to design token value changes
- Ensures tests validate correct token usage rather than specific hex
values
- Aligns with design system best practices
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Dependency of: #26639
Related: #26651
## **Manual testing steps**
```gherkin
Scenario: Verify all updated tests pass
Given the repository with design tokens v8.2.1
When I run the following test files:
| Test File |
| app/components/Snaps/SnapUIRenderer/components/input.test.ts |
| app/components/UI/Bridge/components/TransactionDetails/BridgeStepDescription.test.tsx |
| app/components/UI/Card/components/Onboarding/VerifyIdentity.test.tsx |
| app/components/UI/Earn/Views/EarnLendingWithdrawalConfirmationView/EarnLendingWithdrawalConfirmationView.test.tsx |
| app/components/UI/Rewards/hooks/useRewardsToast.test.tsx |
| app/components/Views/confirmations/components/UI/info-row-divider/info-row-divider.test.tsx |
Then all tests should pass
And snapshots should match expected values
```
## **Screenshots/Recordings**
N/A - Test-only changes
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
- [x] I've properly set the pull request status:
- [x] In case it's not yet "ready for review", I've set it to "draft".
- [x] In case it's "ready for review", I've changed it from "draft" to
"non-draft".
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Test-only changes that update assertions to reference theme tokens,
reducing brittleness during design-token updates. Low risk aside from
potential snapshot/assertion adjustments if token mappings differ.
>
> **Overview**
> Updates several UI/unit tests to assert against theme design tokens
(via `mockTheme.colors.*`) instead of hardcoded hex values, including
Snap UI input borders, Bridge step text colors, Earn navbar background,
and Rewards toast icon colors.
>
> Adjusts tests that relied on inline snapshots/mocked theme shapes by
switching to token-backed assertions (and using `brandColors` for static
camera overlay colors in Veriff branding) to keep tests resilient to
design-token value changes.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
04dc67e. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>1 parent 0f16851 commit 341cbba
6 files changed
Lines changed: 65 additions & 49 deletions
File tree
- app/components
- Snaps/SnapUIRenderer/components
- UI
- Bridge/components/TransactionDetails
- Card/components/Onboarding
- Earn/Views/EarnLendingWithdrawalConfirmationView
- Rewards/hooks
- Views/confirmations/components/UI/info-row-divider
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
19 | | - | |
| 19 | + | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
Lines changed: 33 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
145 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
146 | 150 | | |
147 | 151 | | |
148 | 152 | | |
| |||
155 | 159 | | |
156 | 160 | | |
157 | 161 | | |
158 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
159 | 166 | | |
160 | 167 | | |
161 | 168 | | |
| |||
173 | 180 | | |
174 | 181 | | |
175 | 182 | | |
176 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
177 | 187 | | |
178 | 188 | | |
179 | 189 | | |
| |||
192 | 202 | | |
193 | 203 | | |
194 | 204 | | |
195 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
196 | 209 | | |
197 | 210 | | |
198 | 211 | | |
| |||
213 | 226 | | |
214 | 227 | | |
215 | 228 | | |
216 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
217 | 233 | | |
218 | 234 | | |
219 | 235 | | |
| |||
234 | 250 | | |
235 | 251 | | |
236 | 252 | | |
237 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
238 | 257 | | |
239 | 258 | | |
240 | 259 | | |
| |||
283 | 302 | | |
284 | 303 | | |
285 | 304 | | |
286 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
287 | 309 | | |
288 | 310 | | |
289 | 311 | | |
| |||
297 | 319 | | |
298 | 320 | | |
299 | 321 | | |
300 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
301 | 326 | | |
302 | 327 | | |
303 | 328 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
463 | 464 | | |
464 | 465 | | |
465 | 466 | | |
466 | | - | |
467 | | - | |
| 467 | + | |
| 468 | + | |
468 | 469 | | |
469 | 470 | | |
470 | 471 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
234 | 235 | | |
235 | 236 | | |
236 | 237 | | |
237 | | - | |
| 238 | + | |
238 | 239 | | |
239 | 240 | | |
240 | 241 | | |
| |||
Lines changed: 12 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
54 | 43 | | |
55 | 44 | | |
56 | 45 | | |
| |||
107 | 96 | | |
108 | 97 | | |
109 | 98 | | |
110 | | - | |
| 99 | + | |
111 | 100 | | |
112 | 101 | | |
113 | 102 | | |
| |||
131 | 120 | | |
132 | 121 | | |
133 | 122 | | |
134 | | - | |
| 123 | + | |
135 | 124 | | |
136 | 125 | | |
137 | 126 | | |
| |||
154 | 143 | | |
155 | 144 | | |
156 | 145 | | |
157 | | - | |
| 146 | + | |
158 | 147 | | |
159 | 148 | | |
160 | 149 | | |
| |||
178 | 167 | | |
179 | 168 | | |
180 | 169 | | |
181 | | - | |
| 170 | + | |
182 | 171 | | |
183 | 172 | | |
184 | 173 | | |
| |||
Lines changed: 12 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
25 | 24 | | |
26 | 25 | | |
0 commit comments