MetaMask / metamask-mobile

Mobile web browser providing access to websites that use the Ethereum blockchain
https://metamask.io
Other
2.04k stars 1.06k forks source link

Fix store test circular dependency #8756

Open NicolasMassart opened 4 months ago

NicolasMassart commented 4 months ago

What is this about?

https://github.com/MetaMask/metamask-mobile/pull/8748/files#diff-60a04de3137b833473fa9964bfd0173a9607fc03abcf2b673b31d047ee305b27R23-R39

Scenario

No response

Design

No response

Technical Details

  1. checkout main
  2. yarn setup
  3. jest app/components/UI/Ramp/Views/OrdersList/OrdersList.test.tsx
  4. Test should pass
  5. now just comment lines 25 on app/core/Analytics/index.ts
  6. // export { store };
  7. run jest app/components/UI/Ramp/Views/OrdersList/OrdersList.test.tsx again
  8. Test should fail with No reducer provided for key "fiatOrders"

Add lint rule for catching cir deps - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-cycle.md

Threat Modeling Framework

No response

Acceptance Criteria

Stakeholder review needed before the work gets merged

References

https://github.com/MetaMask/metamask-mobile/pull/8748/files#diff-60a04de3137b833473fa9964bfd0173a9607fc03abcf2b673b31d047ee305b27R23-R39

wachunei commented 3 months ago

Can we add https://github.com/MetaMask/metamask-mobile/pull/8138 as part of the issue and acceptance criteria?

wachunei commented 1 month ago

I'll leave two examples here, first:

So here we see some utils are not pure and can be extracted as "Engine utils".

Second: