diff options
author | kumavis <kumavis@users.noreply.github.com> | 2017-08-09 06:54:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-09 06:54:08 +0800 |
commit | cd1437fdd3fa897720733a5a5099e640bde5dfa2 (patch) | |
tree | e828cebde61f8fef7efc483a9fee43748318f4b7 /test/stub/provider.js | |
parent | 57abc58d623b66a091987a944d8c45737f4feabe (diff) | |
parent | 88b84e389513c3486e99c09b9a589c2a6f636248 (diff) | |
download | tangerine-wallet-browser-cd1437fdd3fa897720733a5a5099e640bde5dfa2.tar tangerine-wallet-browser-cd1437fdd3fa897720733a5a5099e640bde5dfa2.tar.gz tangerine-wallet-browser-cd1437fdd3fa897720733a5a5099e640bde5dfa2.tar.bz2 tangerine-wallet-browser-cd1437fdd3fa897720733a5a5099e640bde5dfa2.tar.lz tangerine-wallet-browser-cd1437fdd3fa897720733a5a5099e640bde5dfa2.tar.xz tangerine-wallet-browser-cd1437fdd3fa897720733a5a5099e640bde5dfa2.tar.zst tangerine-wallet-browser-cd1437fdd3fa897720733a5a5099e640bde5dfa2.zip |
Merge pull request #1861 from MetaMask/transactionControllerRefractor
Transaction controller refractor part 2
Diffstat (limited to 'test/stub/provider.js')
-rw-r--r-- | test/stub/provider.js | 25 |
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 |