Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add unit test for assets polling loops #28646

Merged
merged 2 commits into from
Nov 22, 2024

Conversation

salimtb
Copy link
Contributor

@salimtb salimtb commented Nov 22, 2024

Description

the goal of this PR is to add unit tests for all multichain assets polling loops

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
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.

@salimtb salimtb marked this pull request as ready for review November 22, 2024 11:39
@salimtb salimtb requested a review from a team as a code owner November 22, 2024 11:39
@metamaskbot
Copy link
Collaborator

Builds ready [e5f3894]
Page Load Metrics (1996 ± 86 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint32523761914405195
domContentLoaded17532345196817383
load17702378199617986
domInteractive168138178
backgroundConnect117130189
firstReactRender743101326531
getState580262512
initialActions00000
loadScripts12441735144214168
setupStore683272713
uiStartup198029362288309148
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@salimtb salimtb force-pushed the salim/add-unit-test-for-polling-loops branch from 5c5b246 to 71fce30 Compare November 22, 2024 17:43
Comment on lines +21 to +33
beforeEach(() => {
// Mock process.env.PORTFOLIO_VIEW
originalPortfolioView = process.env.PORTFOLIO_VIEW;
process.env.PORTFOLIO_VIEW = 'true'; // Set your desired mock value here

mockPromises = [];
jest.clearAllMocks();
});

afterEach(() => {
// Restore the original value
process.env.PORTFOLIO_VIEW = originalPortfolioView;
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will these need to be removed once we nuke the feature flag from the codebase?

});

it('should poll token detection for chain IDs when enabled and stop on dismount', async () => {
process.env.PORTFOLIO_VIEW = 'true';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Comment on lines +21 to +33
beforeEach(() => {
// Mock process.env.PORTFOLIO_VIEW
originalPortfolioView = process.env.PORTFOLIO_VIEW;
process.env.PORTFOLIO_VIEW = 'true'; // Set your desired mock value here

mockPromises = [];
jest.clearAllMocks();
});

afterEach(() => {
// Restore the original value
process.env.PORTFOLIO_VIEW = originalPortfolioView;
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

@metamaskbot
Copy link
Collaborator

Builds ready [71fce30]
Page Load Metrics (1625 ± 46 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1486192016349545
domContentLoaded1478182716027737
load1483192316259546
domInteractive136731136
backgroundConnect997242311
firstReactRender492851466029
getState469152110
initialActions00000
loadScripts1059134411736531
setupStore510711
uiStartup16632228191316881
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@salimtb salimtb added this pull request to the merge queue Nov 22, 2024
Merged via the queue into develop with commit b38244b Nov 22, 2024
75 checks passed
@salimtb salimtb deleted the salim/add-unit-test-for-polling-loops branch November 22, 2024 18:41
@github-actions github-actions bot locked and limited conversation to collaborators Nov 22, 2024
@metamaskbot metamaskbot added the release-12.9.0 Issue or pull request that will be included in release 12.9.0 label Nov 22, 2024
@salimtb salimtb added the portfolio-view Used for PRs and issues related to Q4 2024 portfolio view label Nov 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
portfolio-view Used for PRs and issues related to Q4 2024 portfolio view release-12.9.0 Issue or pull request that will be included in release 12.9.0 team-assets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants