A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
ciphermask/test/unit/app/controllers/token-rates-controller.js

25 lines
931 B

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: [] })
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()
})
})