fix(e2e): add default mock for single-token metadata API endpoint#28146
fix(e2e): add default mock for single-token metadata API endpoint#28146dylanbutler1 wants to merge 3 commits intomainfrom
Conversation
The token controller fetches /token/{chainId}?address=0x... for any
token the app encounters (swap quotes, bridge destinations, mUSD, etc.).
This endpoint was only mocked per-test for specific addresses, so any
test that triggered a request for an unmocked address caused
validateLiveRequests() to fail with "unmocked request" errors.
This was the primary cause of trade-ios-smoke-1 failures this week —
bridge, swap, gasless swap, and deeplink tests all hit the mUSD token
metadata endpoint on chains 1 and 59144 without a corresponding mock.
Add a default catch-all regex for /token/{chainId}?address=... that
returns a minimal valid response. Per-test mocks with higher specificity
still take precedence via MockServerE2E's matching order.
Made-with: Cursor
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
…sponse Made-with: Cursor
aa272f5
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Nature of the change:
Why these tags:
Why not all tags:
Performance tests: No performance impact expected from a test mock change. Performance Test Selection: |
|
|
✅ E2E Fixture Validation — Schema is up to date |




Description
The
trade-ios-smoke-1job has been failing this week across bridge, swap, gasless swap, and deeplink tests with:Root cause: The default E2E mocks in
token-apis.tscover/tokens/{chainId}(plural — token lists),/assets?(v2), andtokens.api.../v3/assets(v3), but not/token/{chainId}?address=...(singular — single-token metadata). This endpoint is called by the token controller whenever the app encounters a token (swap quotes, bridge destinations, etc.). It was only mocked in per-test setups for specific addresses (mUSD conversion, perps, polymarket), so any test hitting a different token/chain combo triggeredvalidateLiveRequests()failure.The address
0xacA92E438df0B2401fF60dA7E4337B687a2435DAis the mUSD token on Ethereum (chain 1) and Linea (chain 59144).Fix: Add a default catch-all regex mock for
/token/{chainId}?address=0x...that returns a minimal valid token metadata response. Per-test mocks with higher specificity still take precedence.Changelog
CHANGELOG entry: null
Related issues
Refs: #26568
Manual testing steps
Screenshots/Recordings
N/A — no UI changes, E2E test infrastructure only.
Before
N/A
After
N/A
Pre-merge author checklist
Pre-merge reviewer checklist
Made with Cursor
Note
Low Risk
Test-only mocking change; main risk is a too-broad regex masking missing per-test mocks or affecting tests that expect real token metadata.
Overview
Adds a default GET mock for the Token API single-token metadata endpoint (
/token/{chainId}?address=0x...) intests/api-mocking/mock-responses/defaults/token-apis.ts, matching requests via a new regex.The mock returns a minimal token metadata payload (address/symbol/decimals/name/iconUrl, etc.) so E2E runs don’t fail
validateLiveRequests()when tests encounter previously-unmocked tokens/chains.Written by Cursor Bugbot for commit aa272f5. This will update automatically on new commits. Configure here.