refactor(tests): remove tree.root traversal anti-pattern from RN test suite#1184
refactor(tests): remove tree.root traversal anti-pattern from RN test suite#1184georgewrmarshall wants to merge 4 commits into
Conversation
📖 Storybook Preview |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Describe block label contradicts its remaining test
- Renamed the describe label to reflect iconClassName/textClassName being omitted, matching the remaining test.
Or push these changes by commenting:
@cursor push 523553ffe2
Preview (523553ffe2)
diff --git a/packages/design-system-react-native/src/components/ButtonBase/ButtonBase.test.tsx b/packages/design-system-react-native/src/components/ButtonBase/ButtonBase.test.tsx
--- a/packages/design-system-react-native/src/components/ButtonBase/ButtonBase.test.tsx
+++ b/packages/design-system-react-native/src/components/ButtonBase/ButtonBase.test.tsx
@@ -299,7 +299,7 @@
});
});
- describe('when iconClassName and textClassName are set', () => {
+ describe('when iconClassName and textClassName are omitted', () => {
it('renders icons without extra classes when hooks are omitted', () => {
const { getByText } = render(
<ButtonBase startIconName={IconName.Add} endIconName={IconName.Close}>You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 2fd0146. Configure here.
2fd0146 to
d80aaa8
Compare
📖 Storybook Preview |
📖 Storybook Preview |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Caution MetaMask internal reviewing guidelines:
|
📖 Storybook Preview |
📖 Storybook Preview |


Description
This PR prepares the React Native test suite for the upcoming React Native Testing Library v14 upgrade. It is intentionally staying as a draft and is not ready to merge until the RNTL v14 upgrade path is finalized.
The branch updates the native test setup to use
@testing-library/react-native@14.0.0-rc.3and replacesreact-test-rendererwithtest-rendererwhere RNTL v14 requires it. It also runs the RNTL v14 async migration across@metamask/design-system-react-nativetests, sorender,renderHook,fireEvent, and related assertions are awaited where needed.This also continues the cleanup from #1182: tests avoid
tree.root,react-test-renderer,UNSAFE_*, and direct composite prop traversal patterns that RNTL documents as anti-patterns. Where those internal-tree assertions previously covered implementation-only branches, this PR documents the reduced branch coverage with per-file Jest thresholds rather than reintroducing brittle tests.Additional follow-up changes in this branch:
await act.Related issues
See: #1182
Manual testing steps
yarn workspace @metamask/design-system-react-native test:verbose --runInBand --coverageyarn lint:eslint packages/design-system-react-native packages/design-system-twrnc-presetyarn constraintsyarn lint:dependenciesScreenshots/Recordings
Before
Tests used
react-test-renderer,tree.root,UNSAFE_*, and direct prop traversal to inspect internal implementation details.After
Tests use RNTL public APIs with async
render,renderHook, andfireEventcalls. Coverage gaps from removed internal-tree assertions are documented injest.config.jswith per-file thresholds and references to the RNTL anti-pattern follow-up.Pre-merge author checklist
Pre-merge reviewer checklist