aboutsummaryrefslogtreecommitdiffstats
path: root/test/stub
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-01-18 13:43:34 +0800
committerkumavis <aaron@kumavis.me>2018-01-18 13:43:34 +0800
commit899e839e7c695ff55572d3eb35a9fee98eff8ca1 (patch)
tree4d472d21996a8e858b04184b3288a91a3e28dc2a /test/stub
parentd7c8ec22a45a704036c4969496ef293c524f4542 (diff)
downloadtangerine-wallet-browser-899e839e7c695ff55572d3eb35a9fee98eff8ca1.tar
tangerine-wallet-browser-899e839e7c695ff55572d3eb35a9fee98eff8ca1.tar.gz
tangerine-wallet-browser-899e839e7c695ff55572d3eb35a9fee98eff8ca1.tar.bz2
tangerine-wallet-browser-899e839e7c695ff55572d3eb35a9fee98eff8ca1.tar.lz
tangerine-wallet-browser-899e839e7c695ff55572d3eb35a9fee98eff8ca1.tar.xz
tangerine-wallet-browser-899e839e7c695ff55572d3eb35a9fee98eff8ca1.tar.zst
tangerine-wallet-browser-899e839e7c695ff55572d3eb35a9fee98eff8ca1.zip
test - createTestProviderTools includes block tracker layer
Diffstat (limited to 'test/stub')
-rw-r--r--test/stub/provider.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/test/stub/provider.js b/test/stub/provider.js
index e1e6ffce6..e77db4e28 100644
--- a/test/stub/provider.js
+++ b/test/stub/provider.js
@@ -1,11 +1,12 @@
const JsonRpcEngine = require('json-rpc-engine')
const scaffoldMiddleware = require('eth-json-rpc-middleware/scaffold')
+const TestBlockchain = require('eth-block-tracker/test/util/testBlockMiddleware')
module.exports = {
createEngineForTestData,
providerFromEngine,
scaffoldMiddleware,
- createStubbedProvider,
+ createTestProviderTools,
}
@@ -18,8 +19,13 @@ function providerFromEngine (engine) {
return provider
}
-function createStubbedProvider (resultStub) {
+function createTestProviderTools (opts = {}) {
const engine = createEngineForTestData()
- engine.push(scaffoldMiddleware(resultStub))
- return providerFromEngine(engine)
+ const testBlockchain = new TestBlockchain()
+ // handle provided hooks
+ engine.push(scaffoldMiddleware(opts.scaffold || {}))
+ // handle block tracker methods
+ engine.push(testBlockchain.createMiddleware())
+ const provider = providerFromEngine(engine)
+ return { provider, engine, testBlockchain }
}