Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate CurrencyRateController to BaseControllerV2 #372

Merged
merged 3 commits into from
May 6, 2021

Commits on May 3, 2021

  1. Migrate CurrencyRateController to BaseControllerV2

    The CurrencyRateController has been migrated to the new base
    controller. The configuration can now only be set during construction,
    as it was never changed at runtime in practice with the old controller.
    Similarly, the `disable` function was removed as it wasn't relied upon
    in practice.
    
    One major change is that the controller doesn't poll after being
    constructed. The "start" method must be called for polling to start.
    The "start" and "stop" methods have been added to loosely follow the
    conventions used in `metamask-extension` to allow starting and stopping
    polling for the purpose of reducing network traffic.
    
    A few tests required substantial updates because of this change. The
    ComposableController tests were easiest to fix by deleting the use of
    the CurrencyRateController completely, since that test was intended to
    test BaseController-based controllers specifically.
    
    The last TokenRatesController test managed to mark the state change
    handlers in that controller as 'covered' without actually asserting
    anything related to that functionality. That broken test was split into
    two pieces, one for each state change handler. Those two tests still
    rely upon mocking a would-be private function, which isn't great, but
    it matches the patterns used elsewhere in that test module. To improve
    it would take a great deal of work, enough for a separate PR.
    Gudahtt committed May 3, 2021
    Configuration menu
    Copy the full SHA
    3947a30 View commit details
    Browse the repository at this point in the history

Commits on May 5, 2021

  1. Rename handle to pollTimeout`

    The `handle` private variable has been renamed to better reflect what
    it is. Also the type was updated to the more-specific `NodeJS.Timeout`.
    
    It seems a bit odd to call this a "timeout" given that it's for a
    repeating interval, but this is the term the Node.js docs use, and I
    can't think of a better one.
    Gudahtt committed May 5, 2021
    Configuration menu
    Copy the full SHA
    3965af4 View commit details
    Browse the repository at this point in the history
  2. Rename interval private variables

    They've been renamed to match the terms used in the MDN docs.
    Gudahtt committed May 5, 2021
    Configuration menu
    Copy the full SHA
    b72c282 View commit details
    Browse the repository at this point in the history