1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/app/scripts/controllers
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
..
ens Use ethereum-ens-network-map for network support (#7960) 2020-01-31 09:56:50 -03:30
network Implementation encrypt/decrypt feature (#7831) 2020-02-19 14:24:16 -04:00
permissions Connect flow via popup (#8269) 2020-04-07 16:08:15 -02:30
transactions Use specified gas limit when speeding up a transaction (#8178) 2020-03-12 11:33:11 -03:00
ab-test.js Remove usages of xtend from the background scripts (#7796) 2020-01-13 08:59:36 -10:00
app-state.js Wait for extension unlock before processing eth_requestAccounts (#8149) 2020-03-23 09:25:55 -07:00
balance.js Consistent jsdoc syntax (#7755) 2020-01-13 14:36:36 -04:00
cached-balances.js Enable arrow-parens ESLint rule 2020-02-15 17:04:21 -03:30
detect-tokens.js Cleanup detect-tokens controller and tests (#8329) 2020-04-13 17:14:42 -03:00
incoming-transactions.js Enable arrow-parens ESLint rule 2020-02-15 17:04:21 -03:30
infura.js Remove usages of xtend from the background scripts (#7796) 2020-01-13 08:59:36 -10:00
onboarding.js Remove usages of xtend from the background scripts (#7796) 2020-01-13 08:59:36 -10:00
preferences.js Update address sync logic (#8224) 2020-03-20 12:37:27 -07:00
README.md
recent-blocks.js Remove usages of xtend from the background scripts (#7796) 2020-01-13 08:59:36 -10:00
threebox.js Migrate codebase to use ESM (#7730) 2020-01-09 00:04:58 -03:30
token-rates.js Enable arrow-parens ESLint rule 2020-02-15 17:04:21 -03:30

Controllers

Different controllers (in the sense of *VC *View-Controller).