mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-27 04:46:10 +01:00
656dc4cf18
The tests for the detect-tokens controller were nearly all broken. They have been fixed, and a few improvements were made to controller itself to help with this. * The core `detectNewTokens` method has been updated to be async, so that the caller can know when the operation had completed. * The part of the function that used `Web3` to check the token balances has been split into a separate function, so that that part could be stubbed out in tests. Eventually we should test this using `ganache` instead, but this was an easier first step. * The internal `tokenAddresses` array is now initialized on construction, rather than upon the first Preferences controller update. The `detectNewTokens` function would have previously failed if it ran prior to this initialization, so it was failing if called before any preferences state changes. Additionally, the `detectTokenBalance` function was removed, as it was no longer used. The tests have been updated to ensure they're actually testing the behavior they purport to be testing. I've simulated a test failure with each one to check that it'd fail when it should. The preferences controller instance was updated to set addresses correctly as well. |
||
---|---|---|
.. | ||
account-import-strategies | ||
controllers | ||
lib | ||
migrations | ||
platforms | ||
background.js | ||
chromereload.js | ||
contentscript.js | ||
first-time-state.js | ||
inpage.js | ||
metamask-controller.js | ||
phishing-detect.js | ||
README.md | ||
ui.js |
Main MetaMask Code
This folder contains the core-code.
Currently, it is organized mostly based on file category, like:
controllers, migrations, lib
Ongoing Task
Refactor code-structure, thus the subsystems are reflected on the filesystem.