mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-29 23:58:06 +01:00
4f3fc95d50
* Use @metamask/eslint-config@1.1.0 * Use eslint-plugin-mocha@6.2.2 * Mark root ESLint config as root * Update Mocha ESLint rules with shared ESLint config
21 lines
789 B
JavaScript
21 lines
789 B
JavaScript
import assert from 'assert'
|
|
import sinon from 'sinon'
|
|
import TokenRatesController from '../../../../app/scripts/controllers/token-rates'
|
|
import ObservableStore from 'obs-store'
|
|
|
|
describe('TokenRatesController', function () {
|
|
it('should listen for preferences store updates', function () {
|
|
const preferences = new ObservableStore({ tokens: [] })
|
|
const controller = new TokenRatesController({ preferences })
|
|
preferences.putState({ tokens: ['foo'] })
|
|
assert.deepEqual(controller._tokens, ['foo'])
|
|
})
|
|
|
|
it('should poll on correct interval', async function () {
|
|
const stub = sinon.stub(global, 'setInterval')
|
|
new TokenRatesController({ interval: 1337 }) // eslint-disable-line no-new
|
|
assert.strictEqual(stub.getCall(0).args[1], 1337)
|
|
stub.restore()
|
|
})
|
|
})
|