test: add missing mocks for aggregator metadata, block list and include blocked tokens in all tests#25206
Merged
test: add missing mocks for aggregator metadata, block list and include blocked tokens in all tests#25206
Conversation
Contributor
|
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. |
Collaborator
Builds ready [7adf39b]
Page Load Metrics (51 ± 3 ms)
Bundle size diffs
|
DDDDDanica
approved these changes
Jun 11, 2024
Contributor
|
Good finding, LGTM ! |
vthomas13
reviewed
Jun 12, 2024
|
|
||
| await server | ||
| .forGet('https://swap.api.cx.metamask.io/networks/1/token') | ||
| .forGet(`${SWAPS_API_V2_BASE_URL}/networks/1/token`) |
vthomas13
approved these changes
Jun 12, 2024
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
The responses for the API Calls to aggregator metadata, block list and blocked tokens are not currently mocked on any tests, however the requests happen in the majority of tests. These request return a json back that takes in some occasions more than 1 second to return.
With this PR we mock these responses, so they are immediate, mitigating any possible delay and flakiness due to real live requests.
Note: We are returning the data, since it's been seen that if we return just an empty json, some tests fail as they rely on some data from that requests
Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2637
Manual testing steps
Screenshots/Recordings
Before
See slow responses for the 3 API requests happening in tests:
Pre-merge author checklist
Pre-merge reviewer checklist