aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-01-12 11:26:56 +0800
committerkumavis <aaron@kumavis.me>2017-01-12 11:31:42 +0800
commit2019c02fc0fc33d4bd98416654370250d7aa0ca6 (patch)
treeadf50466f1c0950cd02c27fbfcefe211c190175d /test
parent8012ede12698477692b80769781096b559159a32 (diff)
downloadtangerine-wallet-browser-2019c02fc0fc33d4bd98416654370250d7aa0ca6.tar
tangerine-wallet-browser-2019c02fc0fc33d4bd98416654370250d7aa0ca6.tar.gz
tangerine-wallet-browser-2019c02fc0fc33d4bd98416654370250d7aa0ca6.tar.bz2
tangerine-wallet-browser-2019c02fc0fc33d4bd98416654370250d7aa0ca6.tar.lz
tangerine-wallet-browser-2019c02fc0fc33d4bd98416654370250d7aa0ca6.tar.xz
tangerine-wallet-browser-2019c02fc0fc33d4bd98416654370250d7aa0ca6.tar.zst
tangerine-wallet-browser-2019c02fc0fc33d4bd98416654370250d7aa0ca6.zip
test - fix tests from obs-store
Diffstat (limited to 'test')
-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