Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information