aboutsummaryrefslogtreecommitdiffstats
path: root/test/stub
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-04-28 08:11:44 +0800
committerkumavis <aaron@kumavis.me>2018-04-28 08:11:44 +0800
commitb487dab2e78be64a05a8eaa9c3dcd481f4aebb84 (patch)
tree9d630e502bcb61ab92853249d140743670a930ac /test/stub
parent2b9925a9e4d5a1495c8ccf4a265a179eca7868ad (diff)
downloadtangerine-wallet-browser-b487dab2e78be64a05a8eaa9c3dcd481f4aebb84.tar
tangerine-wallet-browser-b487dab2e78be64a05a8eaa9c3dcd481f4aebb84.tar.gz
tangerine-wallet-browser-b487dab2e78be64a05a8eaa9c3dcd481f4aebb84.tar.bz2
tangerine-wallet-browser-b487dab2e78be64a05a8eaa9c3dcd481f4aebb84.tar.lz
tangerine-wallet-browser-b487dab2e78be64a05a8eaa9c3dcd481f4aebb84.tar.xz
tangerine-wallet-browser-b487dab2e78be64a05a8eaa9c3dcd481f4aebb84.tar.zst
tangerine-wallet-browser-b487dab2e78be64a05a8eaa9c3dcd481f4aebb84.zip
test - unit - use ganache instead of deprecated block-tracker test util
Diffstat (limited to 'test/stub')
-rw-r--r--test/stub/provider.js24
1 files changed, 20 insertions, 4 deletions
diff --git a/test/stub/provider.js b/test/stub/provider.js
index e77db4e28..a1c70486d 100644
--- a/test/stub/provider.js
+++ b/test/stub/provider.js
@@ -1,14 +1,28 @@
const JsonRpcEngine = require('json-rpc-engine')
const scaffoldMiddleware = require('eth-json-rpc-middleware/scaffold')
-const TestBlockchain = require('eth-block-tracker/test/util/testBlockMiddleware')
+const providerAsMiddleware = require('eth-json-rpc-middleware/providerAsMiddleware')
+const GanacheCore = require('ganache-core')
module.exports = {
createEngineForTestData,
providerFromEngine,
scaffoldMiddleware,
createTestProviderTools,
+ getTestSeed,
+ getTestAccounts,
}
+function getTestSeed () {
+ return 'people carpet cluster attract ankle motor ozone mass dove original primary mask'
+}
+
+function getTestAccounts () {
+ return [
+ { address: '0x88bb7F89eB5e5b30D3e15a57C68DBe03C6aCCB21', key: Buffer.from('254A8D551474F35CCC816388B4ED4D20B945C96B7EB857A68064CB9E9FB2C092', 'hex') },
+ { address: '0x1fe9aAB565Be19629fF4e8541ca2102fb42D7724', key: Buffer.from('6BAB5A4F2A6911AF8EE2BD32C6C05F6643AC48EF6C939CDEAAAE6B1620805A9B', 'hex') },
+ { address: '0xbda5c89aa6bA1b352194291AD6822C92AbC87c7B', key: Buffer.from('9B11D7F833648F26CE94D544855558D7053ECD396E4F4563968C232C012879B0', 'hex') },
+ ]
+}
function createEngineForTestData () {
return new JsonRpcEngine()
@@ -21,11 +35,13 @@ function providerFromEngine (engine) {
function createTestProviderTools (opts = {}) {
const engine = createEngineForTestData()
- const testBlockchain = new TestBlockchain()
// handle provided hooks
engine.push(scaffoldMiddleware(opts.scaffold || {}))
// handle block tracker methods
- engine.push(testBlockchain.createMiddleware())
+ engine.push(providerAsMiddleware(GanacheCore.provider({
+ mnemonic: getTestSeed(),
+ })))
+ // wrap in standard provider interface
const provider = providerFromEngine(engine)
- return { provider, engine, testBlockchain }
+ return { provider, engine }
}