aboutsummaryrefslogtreecommitdiffstats
path: root/test/lib
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/migrations/001.json15
-rw-r--r--test/lib/migrations/004.json7
-rw-r--r--test/lib/mock-config-manager.js7
-rw-r--r--test/lib/mock-encryptor.js12
-rw-r--r--test/lib/mock-simple-keychain.js14
-rw-r--r--test/lib/mock-store.js18
6 files changed, 55 insertions, 18 deletions
diff --git a/test/lib/migrations/001.json b/test/lib/migrations/001.json
index 2fe6dd836..7bd55a50e 100644
--- a/test/lib/migrations/001.json
+++ b/test/lib/migrations/001.json
@@ -1 +1,14 @@
-{"version":0,"data":{"wallet":"{\"encSeed\":{\"encStr\":\"rT1C1jjkFRfmrwefscFcwZohl4f+HfIFlBZ9AM4ZD8atJmfKDIQCVK11NYDKYv8ZMIY03f3t8MuoZvfzBL8IJsWnZUhpzVTNNiARQJD2WpGA19eNBzgZm4vd0GwkIUruUDeJXu0iv2j9wU8hOQUqPbOePPy2Am5ro97iuvMAroRTnEKD60qFVg==\",\"nonce\":\"YUY2mwNq2v3FV0Fi94QnSiKFOLYfDR95\"},\"ksData\":{\"m/44'/60'/0'/0\":{\"info\":{\"curve\":\"secp256k1\",\"purpose\":\"sign\"},\"encHdPathPriv\":{\"encStr\":\"Iyi7ft4JQ9UtwrSXRT6ZIHPtZqJhe99rh0uWhNc6QLan6GanY2ZQeU0tt76CBealEWJyrJReSxGQdqDmSDYjpjH3m4JO5l0DfPLPseCqzXV/W+dzM0ubJ8lztLwpwi0L+vULNMqCx4dQtoNbNBq1QZUnjtpm6O8mWpScspboww==\",\"nonce\":\"Z7RqtjNjC6FrLUj5wVW1+HkjOW6Hib6K\"},\"hdIndex\":3,\"encPrivKeys\":{\"edb81c10122f34040cc4bef719a272fbbb1cf897\":{\"key\":\"8ab81tKBd4+CLAbzvS7SBFRTd6VWXBs86uBE43lgcmBu2U7UB22xdH64Q2hUf9eB\",\"nonce\":\"aGUEqI033FY39zKjWmZSI6PQrCLvkiRP\"},\"8bd7d5c000cf05284e98356370dc5ccaa3dbfc38\":{\"key\":\"+i3wmf4b+B898QtlOBfL0Ixirjg59/LLPX61vQ2L0xRPjXzNog0O4Wn15RemM5mY\",\"nonce\":\"imKrlkuoC5uuFkzJBbuDBluGCPJXNTKm\"},\"2340695474656e3124b8eba1172fbfb00eeac8f8\":{\"key\":\"pi+H9D8LYKsdCQKrfaJtsGFjE+X9s74xN675tsoIKrbPXhtpxMLOIQVtSqYveF62\",\"nonce\":\"49g80wDTovHwbguVVYf2FsYbp7Db5OAR\"}},\"addresses\":[\"edb81c10122f34040cc4bef719a272fbbb1cf897\",\"8bd7d5c000cf05284e98356370dc5ccaa3dbfc38\",\"2340695474656e3124b8eba1172fbfb00eeac8f8\"]}},\"version\":2}","config":{"provider":{"type":"etherscan"}}},"meta":{"version":0}} \ No newline at end of file
+{
+ "version": 0,
+ "data": {
+ "wallet": "{\"encSeed\":{\"encStr\":\"rT1C1jjkFRfmrwefscFcwZohl4f+HfIFlBZ9AM4ZD8atJmfKDIQCVK11NYDKYv8ZMIY03f3t8MuoZvfzBL8IJsWnZUhpzVTNNiARQJD2WpGA19eNBzgZm4vd0GwkIUruUDeJXu0iv2j9wU8hOQUqPbOePPy2Am5ro97iuvMAroRTnEKD60qFVg==\",\"nonce\":\"YUY2mwNq2v3FV0Fi94QnSiKFOLYfDR95\"},\"ksData\":{\"m/44'/60'/0'/0\":{\"info\":{\"curve\":\"secp256k1\",\"purpose\":\"sign\"},\"encHdPathPriv\":{\"encStr\":\"Iyi7ft4JQ9UtwrSXRT6ZIHPtZqJhe99rh0uWhNc6QLan6GanY2ZQeU0tt76CBealEWJyrJReSxGQdqDmSDYjpjH3m4JO5l0DfPLPseCqzXV/W+dzM0ubJ8lztLwpwi0L+vULNMqCx4dQtoNbNBq1QZUnjtpm6O8mWpScspboww==\",\"nonce\":\"Z7RqtjNjC6FrLUj5wVW1+HkjOW6Hib6K\"},\"hdIndex\":3,\"encPrivKeys\":{\"edb81c10122f34040cc4bef719a272fbbb1cf897\":{\"key\":\"8ab81tKBd4+CLAbzvS7SBFRTd6VWXBs86uBE43lgcmBu2U7UB22xdH64Q2hUf9eB\",\"nonce\":\"aGUEqI033FY39zKjWmZSI6PQrCLvkiRP\"},\"8bd7d5c000cf05284e98356370dc5ccaa3dbfc38\":{\"key\":\"+i3wmf4b+B898QtlOBfL0Ixirjg59/LLPX61vQ2L0xRPjXzNog0O4Wn15RemM5mY\",\"nonce\":\"imKrlkuoC5uuFkzJBbuDBluGCPJXNTKm\"},\"2340695474656e3124b8eba1172fbfb00eeac8f8\":{\"key\":\"pi+H9D8LYKsdCQKrfaJtsGFjE+X9s74xN675tsoIKrbPXhtpxMLOIQVtSqYveF62\",\"nonce\":\"49g80wDTovHwbguVVYf2FsYbp7Db5OAR\"}},\"addresses\":[\"edb81c10122f34040cc4bef719a272fbbb1cf897\",\"8bd7d5c000cf05284e98356370dc5ccaa3dbfc38\",\"2340695474656e3124b8eba1172fbfb00eeac8f8\"]}},\"version\":2}",
+ "config": {
+ "provider": {
+ "type": "etherscan"
+ }
+ }
+ },
+ "meta": {
+ "version": 0
+ }
+} \ No newline at end of file
diff --git a/test/lib/migrations/004.json b/test/lib/migrations/004.json
index 0e2075c46..a6487c1e2 100644
--- a/test/lib/migrations/004.json
+++ b/test/lib/migrations/004.json
@@ -48,6 +48,13 @@
"title":"Ending Morden Support",
"body":"Due to [recent events](https://blog.ethereum.org/2016/11/20/from-morden-to-ropsten/), MetaMask is now deprecating support for the Morden Test Network.\n\nUsers will still be able to access Morden through a locally hosted node, but we will no longer be providing hosted access to this network through [Infura](http://infura.io/).\n\nPlease use the new Ropsten Network as your new default test network.\n\nYou can fund your Ropsten account using the buy button on your account page.\n\nBest wishes!\nThe MetaMask Team\n\n",
"id":0
+ },
+ {
+ "read":false,
+ "date":"Sat Dec 17 2016",
+ "title":"Keeping It Real",
+ "body":"nonempty",
+ "id":1
}
],
"conversionRate":12.66441492,
diff --git a/test/lib/mock-config-manager.js b/test/lib/mock-config-manager.js
index 72be86ed1..0cc6953bb 100644
--- a/test/lib/mock-config-manager.js
+++ b/test/lib/mock-config-manager.js
@@ -2,9 +2,8 @@ const ObservableStore = require('obs-store')
const clone = require('clone')
const ConfigManager = require('../../app/scripts/lib/config-manager')
const firstTimeState = require('../../app/scripts/first-time-state')
-const STORAGE_KEY = 'metamask-config'
-module.exports = function() {
- let store = new ObservableStore(clone(firstTimeState))
+module.exports = function () {
+ const store = new ObservableStore(clone(firstTimeState))
return new ConfigManager({ store })
-} \ No newline at end of file
+}
diff --git a/test/lib/mock-encryptor.js b/test/lib/mock-encryptor.js
index 09bbf7ad5..cdf13c507 100644
--- a/test/lib/mock-encryptor.js
+++ b/test/lib/mock-encryptor.js
@@ -4,28 +4,28 @@ let cacheVal
module.exports = {
- encrypt(password, dataObj) {
+ encrypt (password, dataObj) {
cacheVal = dataObj
return Promise.resolve(mockHex)
},
- decrypt(password, text) {
+ decrypt (password, text) {
return Promise.resolve(cacheVal || {})
},
- encryptWithKey(key, dataObj) {
+ encryptWithKey (key, dataObj) {
return this.encrypt(key, dataObj)
},
- decryptWithKey(key, text) {
+ decryptWithKey (key, text) {
return this.decrypt(key, text)
},
- keyFromPassword(password) {
+ keyFromPassword (password) {
return Promise.resolve(mockKey)
},
- generateSalt() {
+ generateSalt () {
return 'WHADDASALT!'
},
diff --git a/test/lib/mock-simple-keychain.js b/test/lib/mock-simple-keychain.js
index 615b3e537..d3addc3e8 100644
--- a/test/lib/mock-simple-keychain.js
+++ b/test/lib/mock-simple-keychain.js
@@ -6,32 +6,32 @@ const type = 'Simple Key Pair'
module.exports = class MockSimpleKeychain {
- static type() { return type }
+ static type () { return type }
- constructor(opts) {
+ constructor (opts) {
this.type = type
this.opts = opts || {}
this.wallets = []
}
- serialize() {
+ serialize () {
return [ fakeWallet.privKey ]
}
- deserialize(data) {
+ deserialize (data) {
if (!Array.isArray(data)) {
throw new Error('Simple keychain deserialize requires a privKey array.')
}
this.wallets = [ fakeWallet ]
}
- addAccounts(n = 1) {
- for(var i = 0; i < n; i++) {
+ addAccounts (n = 1) {
+ for (var i = 0; i < n; i++) {
this.wallets.push(fakeWallet)
}
}
- getAccounts() {
+ getAccounts () {
return this.wallets.map(w => w.address)
}
diff --git a/test/lib/mock-store.js b/test/lib/mock-store.js
new file mode 100644
index 000000000..4714c3485
--- /dev/null
+++ b/test/lib/mock-store.js
@@ -0,0 +1,18 @@
+const createStore = require('redux').createStore
+const applyMiddleware = require('redux').applyMiddleware
+const thunkMiddleware = require('redux-thunk')
+const createLogger = require('redux-logger')
+const rootReducer = function() {}
+
+module.exports = configureStore
+
+const loggerMiddleware = createLogger()
+
+const createStoreWithMiddleware = applyMiddleware(
+ thunkMiddleware,
+ loggerMiddleware
+)(createStore)
+
+function configureStore (initialState) {
+ return createStoreWithMiddleware(rootReducer, initialState)
+}