test(bridge): Add integration tests for transfer panel#182
test(bridge): Add integration tests for transfer panel#182chrstph-dvx wants to merge 9 commits intomasterfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive integration tests for the TransferPanel component, which handles token transfers between different blockchain networks. The tests verify that the correct tokens are displayed and available for selection across various transfer scenarios including default token transfers, USDC transfers, ETH/WETH overrides, and token swaps.
Changes:
- Added integration test infrastructure with separate Vitest configuration and setup files
- Implemented 569-line integration test suite covering multiple transfer scenarios across Ethereum, ApeChain, and Superposition networks
- Fixed a bug in useNativeCurrency.ts where the wrong address was being used to fetch ERC20 data
- Enhanced useGasEstimates.ts to properly handle different route types (canonical, LiFi, CCTP, OftV2)
- Fixed HTML semantic issues in NetworkSelectionContainer by replacing nested
<p>tags with<div>and<span>
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.integration.config.ts | New Vitest configuration for integration tests with 120s timeout and happy-dom environment |
| vitest.integration.setup.ts | Setup file that configures axios defaults, mocks animations API, and sets public RPC URLs |
| vitest.config.ts | Updated to exclude integration tests and add @/components alias |
| integration-test-wrapper.tsx | Test wrapper utility providing Overmind, QueryParam, Wagmi, and SWR contexts |
| TransferPanel.integration.test.tsx | Comprehensive integration tests for TransferPanel covering default, USDC, ETH/WETH, and swap scenarios |
| useNativeCurrency.ts | Added try-catch error handling and fallback to config data when ERC20 fetch fails |
| useGasEstimates.ts | Enhanced route selection logic to support LiFi, CCTP, and OftV2 route types |
| DestinationTokenButton.tsx | Simplified to use networks.destinationChainProvider directly |
| NetworkSelectionContainer.tsx | Fixed invalid HTML nesting by changing <p> to <div> and nested <p> to <span> |
| package.json (both) | Added test:integration scripts and jsdom-testing-mocks dependency |
| yarn.lock | Updated dependencies including @WalletConnect, @reown/appkit, and various cryptographic libraries |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
41b199c to
35b70e7
Compare
35b70e7 to
ad792ce
Compare
5f25ed7 to
70cdf98
Compare
|
|
||
| const { childChainProvider } = useNetworksRelationship(networks); | ||
| const nativeCurrency = useNativeCurrency({ provider: childChainProvider }); | ||
| const nativeCurrency = useNativeCurrency({ provider: networks.destinationChainProvider }); |
There was a problem hiding this comment.
It wasn't a big issue, but destination provider is more correct than child here
| <span className="truncate text-base">{network.name}</span> | ||
|
|
||
| <p className="text-xs leading-none text-white/70"> | ||
| <div className="text-xs leading-none text-white/70"> |
There was a problem hiding this comment.
Small fix: it was spamming the console, about p being a parent of p
| [key: string]: string | string[] | undefined; | ||
| }, | ||
| baseUrl: string, | ||
| ) { |
There was a problem hiding this comment.
This function was called on the server, integration test is skipping it. So this util was extracted (without the redirect) to be called in integration test.
70cdf98 to
ecc163e
Compare
ecc163e to
e77f2b0
Compare
fionnachan
left a comment
There was a problem hiding this comment.
this PR shouldn't change any logic in the code because a seemingly small change could break the app
let's only introduce the tests without making any changes unless they are purely HTML element changes
| (sourceChainNativeCurrency.isCustom && destinationChainNativeCurrency.isCustom) || | ||
| networks.sourceChain.id === ChainId.ApeChain | ||
| ) { | ||
| if (sourceChainNativeCurrency.isCustom && destinationChainNativeCurrency.isCustom) { |
|
|
||
| const { childChainProvider } = useNetworksRelationship(networks); | ||
| const nativeCurrency = useNativeCurrency({ provider: childChainProvider }); | ||
| const nativeCurrency = useNativeCurrency({ provider: networks.destinationChainProvider }); |
- update useGasEstimates to be route-aware
89d9148 to
014bd35
Compare

Summary
Steps to test