1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
metamask-extension/test
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
..
data LoginPerSite: Support multiple accounts without automatic switching (#8079) 2020-03-06 13:34:56 -08:00
e2e Connect Screen Multi Select (#8078) 2020-04-02 06:39:53 -02:30
integration Consolidate Home UI (#8141) 2020-02-28 17:46:01 -04:00
lib Remove tOrKey and tOrDefault functions from i18n context (#8211) 2020-03-19 01:03:20 -03:00
stub Migrate codebase to use ESM (#7730) 2020-01-09 00:04:58 -03:30
unit Cleanup detect-tokens controller and tests (#8329) 2020-04-13 17:14:42 -03:00
unit-global Update ESLint rules for test suite (#8023) 2020-02-11 13:21:13 -03:30
web3 Enable arrow-parens ESLint rule 2020-02-15 17:04:21 -03:30
base.conf.js eslint --fix . 2018-07-02 18:49:33 -04:00
env.js Remove cross-env (#7950) 2020-01-30 14:11:26 -03:30
flat.conf.js eslint --fix . 2018-07-02 18:49:33 -04:00
helper.js Various component tests and some conditional statements (#7765) 2020-01-30 11:34:45 -08:00
setup.js Enable arrow-parens ESLint rule 2020-02-15 17:04:21 -03:30