1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-27 04:46:10 +01:00
metamask-extension/app/scripts
Mark Stacey 656dc4cf18
Cleanup detect-tokens controller and tests (#8329)
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.
2020-04-13 17:14:42 -03:00
..
account-import-strategies Clean up "JSON File" import strategy test output (#7855) 2020-01-17 19:59:47 -03:30
controllers Cleanup detect-tokens controller and tests (#8329) 2020-04-13 17:14:42 -03:00
lib Refactor notification manager and triggerUi to use extension platform (#8317) 2020-04-11 12:12:45 -03:00
migrations Enable arrow-parens ESLint rule 2020-02-15 17:04:21 -03:30
platforms Refactor notification manager and triggerUi to use extension platform (#8317) 2020-04-11 12:12:45 -03:00
background.js Focus the notification popup if it's already open (#8318) 2020-04-11 20:43:55 -03:00
chromereload.js Fix console.error references 2016-08-29 17:32:39 -07:00
contentscript.js Merge pull request #8056 from whymarrh/arrow-parens 2020-02-17 15:26:43 -07:00
first-time-state.js Migrate codebase to use ESM (#7730) 2020-01-09 00:04:58 -03:30
inpage.js update inpage-provider; minor fixes (#7997) 2020-02-06 07:57:54 -08:00
metamask-controller.js Connect flow via popup (#8269) 2020-04-07 16:08:15 -02:30
phishing-detect.js Replace METAMASK_UI_TYPE global with helper function (#8279) 2020-04-01 19:28:10 -03:00
README.md add READMEs to folders, re #3427 2018-03-14 15:33:22 +02:00
ui.js Remove ineffectual close popup function (#8316) 2020-04-10 12:27:58 -03:00

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.

Examples