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

test: add a new unit test to cover for multichain feature flags ON #12442

Conversation

EtherWizard33
Copy link
Contributor

@EtherWizard33 EtherWizard33 commented Nov 26, 2024

Once we remove the feature flags, we can delete the old tests, until then this ensure both side of the code is tested.

Description

  • Modifying the env variable corresponding to the feature flag didnt take effect in the test, had to find another way, mocking the getter of the feture flag
  • Mocking the getter worked, but modifying the mock inside the same test file didnt take effect in the component, re-importing the component caused all other mocks to fail, setting all mocks a second time didn't work.
  • Finally something did work, which is having each test in their own test file is the only way i could get the mocks initialized with expected values.

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/3664

Manual testing steps

  1. run npx jest app/components/Views/AccountPermissions/** and all tests should pass

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.

…s temporary until we remove the feature flag and old code, also set the flags to OFF also in the existing test that was testing the code with FF OFF.

Once we remove the feature flags, we can delete the old tests, until then this ensure both side of the code is tested.
@EtherWizard33 EtherWizard33 added Run Smoke E2E Triggers smoke e2e on Bitrise team-wallet-ux labels Nov 26, 2024
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.

Copy link
Contributor

github-actions bot commented Nov 26, 2024

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 6f87244
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/ce799e98-aa90-4e91-b4dd-3f56a0cbfefe

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@EtherWizard33 EtherWizard33 marked this pull request as ready for review November 26, 2024 21:33
@EtherWizard33 EtherWizard33 requested a review from a team as a code owner November 26, 2024 21:33
@EtherWizard33 EtherWizard33 changed the title test: add a new test to cover for multichain feature flags ON test: add a new unit test to cover for multichain feature flags ON Nov 26, 2024
Copy link
Contributor

@tommasini tommasini left a comment

Choose a reason for hiding this comment

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

Account permissions is a component that have some actions, we should aim to unit test those with react-testing-library

@EtherWizard33
Copy link
Contributor Author

EtherWizard33 commented Nov 27, 2024

Account permissions is a component that have some actions, we should aim to unit test those with react-testing-library

agreed, thank you Tomas, this was just a first change to the tests of this component,
this week I have been focusing on e2e, and plan to be putting a lot more time on unit tests next week once e2e has more coverage :)

@EtherWizard33 EtherWizard33 added No QA Needed Apply this label when your PR does not need any QA effort. and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Nov 27, 2024
Copy link

sonarcloud bot commented Nov 27, 2024

@EtherWizard33 EtherWizard33 added this pull request to the merge queue Nov 27, 2024
Merged via the queue into main with commit 6f831d4 Nov 27, 2024
43 checks passed
@EtherWizard33 EtherWizard33 deleted the test-fix-the-unit-tests-that-were-breaking-the-build-with-ff-on branch November 27, 2024 13:59
@github-actions github-actions bot locked and limited conversation to collaborators Nov 27, 2024
@metamaskbot metamaskbot added the release-7.37.0 Issue or pull request that will be included in release 7.37.0 label Nov 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
No QA Needed Apply this label when your PR does not need any QA effort. release-7.37.0 Issue or pull request that will be included in release 7.37.0 team-wallet-ux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants