test: add component test coverage (Tier 4)#418
Merged
gabitoesmiapodo merged 2 commits intotest/utilsfrom Mar 25, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
5 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands Tier 4 component/unit test coverage across shared UI components and utility wrappers, and adjusts the global test setup to support Chakra UI menu/popover behavior in jsdom.
Changes:
- Added test suites for
withSuspense/withSuspenseAndRetry, including retry/reset flow behavior. - Added component tests for
WalletStatusVerifier,TransactionButton,SwitchNetwork, andTokenLogocovering key UI states and fallbacks. - Updated
setupTests.tsto provide aResizeObservermock required by Chakra/@floating-ui in jsdom.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/suspenseWrapper.test.tsx | Verifies suspense + error boundary rendering and retry/reset behavior with React Query integration. |
| src/components/sharedComponents/WalletStatusVerifier.test.tsx | Covers connected/disconnected and wrong-chain gating for the verifier and its HOC. |
| src/components/sharedComponents/TransactionButton.test.tsx | Covers wallet gating, chain mismatch, pending label state, and onMined callback behavior. |
| src/components/sharedComponents/TokenLogo.test.tsx | Covers logo rendering, error fallback to placeholder, sizing, and IPFS URL conversion. |
| src/components/sharedComponents/SwitchNetwork.test.tsx | Covers chain label display, disabled trigger behavior, and menu item rendering after open. |
| setupTests.ts | Adds a ResizeObserver mock to support Chakra menus/popovers in jsdom. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2eaabf8 to
beabdaf
Compare
2ecd9f4 to
b65a318
Compare
beabdaf to
ba75a54
Compare
b65a318 to
03b8d50
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ba75a54 to
1fcbe2f
Compare
03b8d50 to
82f2f21
Compare
New tests for shared components and utilities: - TokenLogo: img src/alt/size, IPFS URL conversion, placeholder on error - TransactionButton: wallet states, pending label, onMined callback - SwitchNetwork: network display, disabled state, menu item rendering - WalletStatusVerifier: connect fallback, wrong chain, synced renders children - withWalletStatusVerifier HOC: fallback and pass-through behavior - withSuspense/withSuspenseAndRetry: Suspense fallback, error message, retry Also adds: - ResizeObserver mock to setupTests.ts (required by @floating-ui in jsdom) - .env.test and src/test-utils.tsx (shared test utilities from tier 1)
- setupTests.ts: replace vi.fn() ResizeObserver with a real class guarded by a conditional check — vi.restoreAllMocks() can no longer clear it - suspenseWrapper.test.tsx: restore only the console.error spy in afterEach instead of vi.restoreAllMocks() which would wipe the ResizeObserver polyfill - TransactionButton.test.tsx: make useWaitForTransactionReceipt mock hash-aware so it only returns the receipt when called with the expected hash
1fcbe2f to
d6ced76
Compare
628a91a to
7b00d3b
Compare
fernandomg
approved these changes
Mar 25, 2026
Comment on lines
+7
to
+8
| // ResizeObserver is not implemented in jsdom but required by @floating-ui (Chakra menus/popovers). | ||
| // Use a real class rather than vi.fn() so vi.restoreAllMocks() in test files cannot clear it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TokenLogo(image rendering, fallback, color generation)TransactionButton(wallet gate, chain mismatch, pending state, onMined)SwitchNetwork(chain selector, menu items, disabled state)WalletStatusVerifierandwithWalletStatusVerifierHOCsuspenseWrapper(withSuspense,withSuspenseAndRetryincluding retry flow)Test plan
pnpm testpasses on this branch