1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-12 04:37:13 +01:00
metamask-extension/test/unit/app/controllers/token-rates-controller.js
Erik Marks 76a2a9bb8b
@metamask/eslint config@5.0.0 (#10358)
* @metamask/eslint-config@5.0.0
* Update eslintrc and prettierrc
* yarn lint:fix
2021-02-04 10:15:23 -08:00

26 lines
964 B
JavaScript

import assert from 'assert';
import sinon from 'sinon';
import { ObservableStore } from '@metamask/obs-store';
import TokenRatesController from '../../../../app/scripts/controllers/token-rates';
describe('TokenRatesController', function () {
it('should listen for preferences store updates', function () {
const preferences = new ObservableStore({ tokens: [] });
preferences.putState({ tokens: ['foo'] });
const controller = new TokenRatesController({ preferences });
assert.deepEqual(controller._tokens, ['foo']);
});
it('should poll on correct interval', async function () {
const stub = sinon.stub(global, 'setInterval');
const preferences = new ObservableStore({ tokens: [] });
preferences.putState({ tokens: ['foo'] });
const controller = new TokenRatesController({ preferences });
controller.start(1337);
assert.strictEqual(stub.getCall(0).args[1], 1337);
stub.restore();
controller.stop();
});
});