aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/lib/mock-config-manager.js7
-rw-r--r--test/unit/idStore-migration-test.js8
-rw-r--r--test/unit/metamask-controller-test.js6
3 files changed, 13 insertions, 8 deletions
diff --git a/test/lib/mock-config-manager.js b/test/lib/mock-config-manager.js
index b79f63090..0e84aa001 100644
--- a/test/lib/mock-config-manager.js
+++ b/test/lib/mock-config-manager.js
@@ -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 () {
diff --git a/test/unit/idStore-migration-test.js b/test/unit/idStore-migration-test.js
index 54f38fb2f..4adbef740 100644
--- a/test/unit/idStore-migration-test.js
+++ b/test/unit/idStore-migration-test.js
@@ -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({
diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js
index 414610404..e648ebd1d 100644
--- a/test/unit/metamask-controller-test.js
+++ b/test/unit/metamask-controller-test.js
@@ -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