Skip to content

chore: Reduce enzymes usage 1/3 (#8721)#8942

Merged
Cal-L merged 2 commits into
mainfrom
chore/8616-reduce-enzyme-usage
Mar 14, 2024
Merged

chore: Reduce enzymes usage 1/3 (#8721)#8942
Cal-L merged 2 commits into
mainfrom
chore/8616-reduce-enzyme-usage

Conversation

@Cal-L

@Cal-L Cal-L commented Mar 14, 2024

Copy link
Copy Markdown
Contributor

Description

This PR merges @timi-codes 's PR that converts some of the unit tests to use react testing library.
The original PR is here - #8721

Convert the list of unit tests to use react-testing-library instead of enzyme for the following files:

'app/components/Views/Root/index.test.tsx',
'app/components/Views/NavigationUnitTest/TestScreen3.test.js',
'app/components/Views/NavigationUnitTest/TestScreen2.test.js',
'app/components/Views/NavigationUnitTest/TestScreen1.test.js',
'app/components/Views/ImportPrivateKeySuccess/index.test.tsx',
'app/components/Views/AccountBackupStep1B/index.test.tsx',
'app/components/UI/WebviewProgressBar/index.test.tsx',
'app/components/UI/SeedphraseModal/index.test.tsx',
'app/components/UI/PhishingModal/index.test.tsx',
'app/components/UI/FoxScreen/index.test.tsx',
'app/components/UI/FadeView/index.test.tsx',
'app/components/UI/CustomAlert/index.test.tsx',
'app/components/UI/Confetti/index.test.tsx',
'app/components/UI/Collectibles/index.test.tsx',
'app/components/UI/Button/index.test.tsx',
'app/components/UI/AnimatedSpinner/index.test.tsx',
'app/components/UI/AddCustomToken/index.test.tsx',

Related issues

Fixes: #8616

Manual testing steps

Not Applicable

Screenshots/Recordings

Not Applicable

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
  • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

Description

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

## **Description**

Convert the list of unit tests to use react-testing-library instead of
enzyme for the following files:
```
'app/components/Views/Root/index.test.tsx',
'app/components/Views/NavigationUnitTest/TestScreen3.test.js',
'app/components/Views/NavigationUnitTest/TestScreen2.test.js',
'app/components/Views/NavigationUnitTest/TestScreen1.test.js',
'app/components/Views/ImportPrivateKeySuccess/index.test.tsx',
'app/components/Views/AccountBackupStep1B/index.test.tsx',
'app/components/UI/WebviewProgressBar/index.test.tsx',
'app/components/UI/SeedphraseModal/index.test.tsx',
'app/components/UI/PhishingModal/index.test.tsx',
'app/components/UI/FoxScreen/index.test.tsx',
'app/components/UI/FadeView/index.test.tsx',
'app/components/UI/CustomAlert/index.test.tsx',
'app/components/UI/Confetti/index.test.tsx',
'app/components/UI/Collectibles/index.test.tsx',
'app/components/UI/Button/index.test.tsx',
'app/components/UI/AnimatedSpinner/index.test.tsx',
'app/components/UI/AddCustomToken/index.test.tsx',
```

## **Related issues**

Fixes: #8616 

## **Manual testing steps**

Not Applicable

## **Screenshots/Recordings**

Not Applicable

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've clearly explained what problem this PR is solving and how it
is solved.
- [x] I've linked related issues
- [ ] I've included manual testing steps
- [ ] I've included screenshots/recordings if applicable
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
- [x] I’ve properly set the pull request status:
  - [ ] In case it's not yet "ready for review", I've set it to "draft".
- [x] In case it's "ready for review", I've changed it from "draft" to
"non-draft".

## **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.

---------

Co-authored-by: Cal Leung <cleun007@gmail.com>
@Cal-L Cal-L requested a review from a team as a code owner March 14, 2024 16:40
@github-actions

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

@Cal-L Cal-L added team-mobile-platform Mobile Platform team No QA Needed Apply this label when your PR does not need any QA effort. labels Mar 14, 2024
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@tommasini tommasini left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@Cal-L Cal-L merged commit 57be624 into main Mar 14, 2024
@Cal-L Cal-L deleted the chore/8616-reduce-enzyme-usage branch March 14, 2024 19:39
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 14, 2024
@metamaskbot metamaskbot added the release-7.19.0 Issue or pull request that will be included in release 7.19.0 label Mar 14, 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.19.0 Issue or pull request that will be included in release 7.19.0 team-mobile-platform Mobile Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce enzyme usage in unit test by 25% - [1 of 3]

4 participants