1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00
metamask-extension/app
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
..
_locales Show correct description for empty Connected Sites modal (#8298) 2020-04-08 10:14:54 -02:30
fonts Use @fortawesome/fontawesome-free npm package (#8256) 2020-03-30 20:05:51 -03:00
images Connect flow via popup (#8269) 2020-04-07 16:08:15 -02:30
manifest Build system refactor (#8140) 2020-03-09 08:55:02 +08:00
scripts Cleanup detect-tokens controller and tests (#8329) 2020-04-13 17:14:42 -03:00
vendor/trezor Close window after opening fullscreen (#6966) 2019-08-08 11:50:32 -03:00
home.html Add optional portal to Popover component (#8253) 2020-03-30 18:25:17 -02:30
loading.html refactor & change html pages 2019-05-04 18:57:19 +02:00
notification.html Add optional portal to Popover component (#8253) 2020-03-30 18:25:17 -02:30
phishing.html Use main style bundle for phishing page (#8255) 2020-03-30 19:44:46 -03:00
popup.html Add optional portal to Popover component (#8253) 2020-03-30 18:25:17 -02:30
trezor-usb-permissions.html trezor v5 working on firefox 2018-08-05 02:43:02 -04:00
unsupport.html Rename files 2018-05-29 12:44:37 +08:00