aboutsummaryrefslogtreecommitdiffstats
path: root/test/stub/provider.js
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2017-08-09 14:30:58 +0800
committerGitHub <noreply@github.com>2017-08-09 14:30:58 +0800
commit0188e7b94d85b45a783f9e3d5c182a8ffcaeac2e (patch)
tree428154973b91dfb2f8519777e67da7a6c75530b3 /test/stub/provider.js
parent5e9926b0d035a5ba946080e94777ac0bd887d396 (diff)
parent57f6fce6b2524c4b36b591da5e600d0652f4077e (diff)
downloadtangerine-wallet-browser-0188e7b94d85b45a783f9e3d5c182a8ffcaeac2e.tar
tangerine-wallet-browser-0188e7b94d85b45a783f9e3d5c182a8ffcaeac2e.tar.gz
tangerine-wallet-browser-0188e7b94d85b45a783f9e3d5c182a8ffcaeac2e.tar.bz2
tangerine-wallet-browser-0188e7b94d85b45a783f9e3d5c182a8ffcaeac2e.tar.lz
tangerine-wallet-browser-0188e7b94d85b45a783f9e3d5c182a8ffcaeac2e.tar.xz
tangerine-wallet-browser-0188e7b94d85b45a783f9e3d5c182a8ffcaeac2e.tar.zst
tangerine-wallet-browser-0188e7b94d85b45a783f9e3d5c182a8ffcaeac2e.zip
Merge branch 'master' into NewUI-flat
Diffstat (limited to 'test/stub/provider.js')
-rw-r--r--test/stub/provider.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/stub/provider.js b/test/stub/provider.js
new file mode 100644
index 000000000..8a306f6d9
--- /dev/null
+++ b/test/stub/provider.js
@@ -0,0 +1,25 @@
+const JsonRpcEngine = require('json-rpc-engine')
+const scaffoldMiddleware = require('eth-json-rpc-middleware/scaffold')
+
+module.exports = {
+ createEngineForTestData,
+ providerFromEngine,
+ scaffoldMiddleware,
+ createStubedProvider
+}
+
+
+function createEngineForTestData () {
+ return new JsonRpcEngine()
+}
+
+function providerFromEngine (engine) {
+ const provider = { sendAsync: engine.handle.bind(engine) }
+ return provider
+}
+
+function createStubedProvider (resultStub) {
+ const engine = createEngineForTestData()
+ engine.push(scaffoldMiddleware(resultStub))
+ return providerFromEngine(engine)
+} \ No newline at end of file