Skip to content

Commit 943af77

Browse files
test: use fontStyles from common.ts in BridgeStepDescription test (MetaMask#23659)
## **Description** This PR fixes a test that would fail after the expo-font changes in MetaMask#23517. The `BridgeStepDescription.test.tsx` file had hardcoded font family assertions (e.g., `'Geist Medium'`, `'Geist Regular'`) that will break when font file names change to hyphenated format (e.g., `'Geist-Medium'`, `'Geist-Regular'`). Instead of updating to new hardcoded values, this PR references the centralized `fontStyles` definitions from `app/styles/common.ts`, making the test more maintainable and ensuring a single source of truth for font families. **Changes:** - Import `fontStyles` from `app/styles/common.ts` - Replace `'Geist Medium'` assertions with `fontStyles.medium.fontFamily` - Replace `'Geist Regular'` assertions with `fontStyles.normal.fontFamily` ## **Changelog** CHANGELOG entry: null ## **Related issues** Related to MetaMask#23517 (main expo-font PR) Related to MetaMask#23650 (brand font fixes PR) ## **Manual testing steps** ```gherkin Feature: BridgeStepDescription test suite Scenario: developer runs test suite Given the font family definitions have been updated to use hyphens When developer runs yarn jest BridgeStepDescription.test.tsx Then all 22 tests should pass successfully ``` ## **Screenshots/Recordings** N/A - Test-only change ### **Before** Test assertions used hardcoded font family strings that would fail after font renaming. ### **After** Test assertions reference `fontStyles` from `common.ts` and pass with new font names. ## **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/CODING_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. ## **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. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Update BridgeStepDescription tests to reference centralized fontStyles instead of hardcoded font family strings. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 4b8f8d2. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Claude <noreply@anthropic.com>
1 parent faca809 commit 943af77

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

app/components/UI/Bridge/components/TransactionDetails/BridgeStepDescription.test.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
TransactionStatus,
1313
CHAIN_IDS,
1414
} from '@metamask/transaction-controller';
15+
import { fontStyles } from '../../../../../styles/common';
1516

1617
describe('BridgeStepDescription', () => {
1718
const mockStep = {
@@ -128,7 +129,7 @@ describe('BridgeStepDescription', () => {
128129
const textElement = getByText(/ETH/);
129130
expect(textElement.props.style).toHaveProperty(
130131
'fontFamily',
131-
'Geist Medium',
132+
fontStyles.medium.fontFamily,
132133
);
133134
});
134135

@@ -157,7 +158,7 @@ describe('BridgeStepDescription', () => {
157158
expect(textElement.props.style).toHaveProperty('color', '#121314');
158159
expect(textElement.props.style).toHaveProperty(
159160
'fontFamily',
160-
'Geist Regular',
161+
fontStyles.normal.fontFamily,
161162
);
162163
});
163164

@@ -175,7 +176,7 @@ describe('BridgeStepDescription', () => {
175176
expect(textElement.props.style).toHaveProperty('color', '#121314');
176177
expect(textElement.props.style).toHaveProperty(
177178
'fontFamily',
178-
'Geist Regular',
179+
fontStyles.normal.fontFamily,
179180
);
180181
});
181182

@@ -194,7 +195,7 @@ describe('BridgeStepDescription', () => {
194195
expect(textElement.props.style).toHaveProperty('color', '#121314');
195196
expect(textElement.props.style).toHaveProperty(
196197
'fontFamily',
197-
'Geist Regular',
198+
fontStyles.normal.fontFamily,
198199
);
199200
});
200201

@@ -215,7 +216,7 @@ describe('BridgeStepDescription', () => {
215216
expect(textElement.props.style).toHaveProperty('color', '#121314');
216217
expect(textElement.props.style).toHaveProperty(
217218
'fontFamily',
218-
'Geist Medium',
219+
fontStyles.medium.fontFamily,
219220
);
220221
});
221222

@@ -236,7 +237,7 @@ describe('BridgeStepDescription', () => {
236237
expect(textElement.props.style).toHaveProperty('color', '#121314');
237238
expect(textElement.props.style).toHaveProperty(
238239
'fontFamily',
239-
'Geist Medium',
240+
fontStyles.medium.fontFamily,
240241
);
241242
});
242243

@@ -285,7 +286,7 @@ describe('BridgeStepDescription', () => {
285286
expect(textElement.props.style).toHaveProperty('color', '#686e7d');
286287
expect(textElement.props.style).toHaveProperty(
287288
'fontFamily',
288-
'Geist Regular',
289+
fontStyles.normal.fontFamily,
289290
);
290291
});
291292

@@ -299,7 +300,7 @@ describe('BridgeStepDescription', () => {
299300
expect(textElement.props.style).toHaveProperty('color', '#686e7d');
300301
expect(textElement.props.style).toHaveProperty(
301302
'fontFamily',
302-
'Geist Regular',
303+
fontStyles.normal.fontFamily,
303304
);
304305
});
305306

0 commit comments

Comments
 (0)