mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 10:30:04 +01:00
92971d3c87
* Update eslint-plugin-import version * Convert JS files to use ESM * Update ESLint rules to check imports * Fix test:unit:global command env * Cleanup mock-dev script
21 lines
771 B
JavaScript
21 lines
771 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', () => {
|
|
it('should listen for preferences store updates', () => {
|
|
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 () => {
|
|
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()
|
|
})
|
|
})
|