1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

test - fix tests from obs-store

This commit is contained in:
kumavis 2017-01-11 19:26:56 -08:00
parent 8012ede126
commit 2019c02fc0
3 changed files with 13 additions and 8 deletions

View File

@ -1,9 +1,12 @@
var ConfigManager = require('../../app/scripts/lib/config-manager')
const ConfigManager = require('../../app/scripts/lib/config-manager')
const ObservableStore = require('../../app/scripts/lib/observable/')
const STORAGE_KEY = 'metamask-config'
const extend = require('xtend')
module.exports = function() {
return new ConfigManager({ loadData, setData })
let store = new ObservableStore(loadData())
store.subscribe(setData)
return new ConfigManager({ store })
}
function loadData () {

View File

@ -3,6 +3,7 @@ const assert = require('assert')
const ethUtil = require('ethereumjs-util')
const BN = ethUtil.BN
const ConfigManager = require('../../app/scripts/lib/config-manager')
const ObservableStore = require('../../app/scripts/lib/observable/')
const delegateCallCode = require('../lib/example-code.json').delegateCallCode
// The old way:
@ -42,10 +43,9 @@ describe('IdentityStore to KeyringController migration', function() {
beforeEach(function(done) {
this.sinon = sinon.sandbox.create()
window.localStorage = {} // Hacking localStorage support into JSDom
configManager = new ConfigManager({
loadData,
setData: (d) => { window.localStorage = d }
})
let store = new ObservableStore(loadData())
store.subscribe(setData)
configManager = new ConfigManager({ store })
idStore = new IdentityStore({

View File

@ -10,9 +10,11 @@ describe('MetaMaskController', function() {
showUnconfirmedMessage: noop,
unlockAccountMessage: noop,
showUnapprovedTx: noop,
setData,
loadData,
// initial state
initState: loadData(),
})
// setup state persistence
controller.store.subscribe(setData)
beforeEach(function() {
// sinon allows stubbing methods that are easily verified