diff options
author | Chi Kei Chan <chikeichan@gmail.com> | 2018-01-18 05:48:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-18 05:48:16 +0800 |
commit | b80ed2c451fee7b94edea9d1655baa2e908939b9 (patch) | |
tree | e9a67e289f043900a77b1bfb34088ad2e5f83864 /test/stub | |
parent | ccb80594be3000488b7c73f9fd5e56168e0d5042 (diff) | |
parent | aa08d1a09dce7324eaa3b3df568df43f8c55cc63 (diff) | |
download | tangerine-wallet-browser-b80ed2c451fee7b94edea9d1655baa2e908939b9.tar tangerine-wallet-browser-b80ed2c451fee7b94edea9d1655baa2e908939b9.tar.gz tangerine-wallet-browser-b80ed2c451fee7b94edea9d1655baa2e908939b9.tar.bz2 tangerine-wallet-browser-b80ed2c451fee7b94edea9d1655baa2e908939b9.tar.lz tangerine-wallet-browser-b80ed2c451fee7b94edea9d1655baa2e908939b9.tar.xz tangerine-wallet-browser-b80ed2c451fee7b94edea9d1655baa2e908939b9.tar.zst tangerine-wallet-browser-b80ed2c451fee7b94edea9d1655baa2e908939b9.zip |
Merge pull request #3007 from alextsg/uat-master-011618
[NewUI] Merge master into uat branch
Diffstat (limited to 'test/stub')
-rw-r--r-- | test/stub/provider.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/stub/provider.js b/test/stub/provider.js index 8a306f6d9..85e1da707 100644 --- a/test/stub/provider.js +++ b/test/stub/provider.js @@ -5,7 +5,8 @@ module.exports = { createEngineForTestData, providerFromEngine, scaffoldMiddleware, - createStubedProvider + createEthJsQueryStub, + createStubedProvider, } @@ -18,6 +19,18 @@ function providerFromEngine (engine) { return provider } +function createEthJsQueryStub (stubProvider) { + return new Proxy({}, { + get: (obj, method) => { + return (...params) => { + return new Promise((resolve, reject) => { + stubProvider.sendAsync({ method: `eth_${method}`, params }, (err, ress) => resolve(ress.result)) + }) + } + }, + }) +} + function createStubedProvider (resultStub) { const engine = createEngineForTestData() engine.push(scaffoldMiddleware(resultStub)) |