diff options
test - createTestProviderTools includes block tracker layer
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/pending-tx-test.js | 4 | ||||
-rw-r--r-- | test/unit/tx-controller-test.js | 24 | ||||
-rw-r--r-- | test/unit/tx-gas-util-test.js | 4 |
3 files changed, 15 insertions, 17 deletions
diff --git a/test/unit/pending-tx-test.js b/test/unit/pending-tx-test.js index de2da6e36..cb29ddafd 100644 --- a/test/unit/pending-tx-test.js +++ b/test/unit/pending-tx-test.js @@ -3,7 +3,7 @@ const ethUtil = require('ethereumjs-util') const EthTx = require('ethereumjs-tx') const ObservableStore = require('obs-store') const clone = require('clone') -const { createStubbedProvider } = require('../stub/provider') +const { createTestProviderTools } = require('../stub/provider') const PendingTransactionTracker = require('../../app/scripts/lib/pending-tx-tracker') const MockTxGen = require('../lib/mock-tx-gen') const sinon = require('sinon') @@ -39,7 +39,7 @@ describe('PendingTransactionTracker', function () { txParams: { from: '0x1678a085c290ebd122dc42cba69373b5953b831d'}, } providerResultStub = {} - provider = createStubbedProvider(providerResultStub) + provider = createTestProviderTools({ scaffold: providerResultStub }).provider pendingTxTracker = new PendingTransactionTracker({ provider, diff --git a/test/unit/tx-controller-test.js b/test/unit/tx-controller-test.js index 84094e00a..cc99afee4 100644 --- a/test/unit/tx-controller-test.js +++ b/test/unit/tx-controller-test.js @@ -6,7 +6,7 @@ const ObservableStore = require('obs-store') const sinon = require('sinon') const TransactionController = require('../../app/scripts/controllers/transactions') const TxGasUtils = require('../../app/scripts/lib/tx-gas-utils') -const { createStubbedProvider } = require('../stub/provider') +const { createTestProviderTools } = require('../stub/provider') const noop = () => true const currentNetworkId = 42 @@ -15,11 +15,18 @@ const privKey = new Buffer('8718b9618a37d1fc78c436511fc6df3c8258d3250635bba617f3 describe('Transaction Controller', function () { - let txController, provider, providerResultStub + let txController, provider, providerResultStub, testBlockchain beforeEach(function () { - providerResultStub = {} - provider = createStubbedProvider(providerResultStub) + providerResultStub = { + // 1 gwei + eth_gasPrice: '0x0de0b6b3a7640000', + // by default, all accounts are external accounts (not contracts) + eth_getCode: '0x', + } + const providerTools = createTestProviderTools({ scaffold: providerResultStub }) + provider = providerTools.provider + testBlockchain = providerTools.testBlockchain txController = new TransactionController({ provider, @@ -153,15 +160,6 @@ describe('Transaction Controller', function () { }) describe('#addUnapprovedTransaction', function () { - let addTxDefaults - beforeEach(() => { - addTxDefaults = txController.addTxDefaults - txController.addTxDefaults = function addTxDefaultsStub () { return Promise.resolve() } - - }) - afterEach(() => { - txController.addTxDefaults = addTxDefaults - }) it('should add an unapproved transaction and return a valid txMeta', function (done) { txController.addUnapprovedTransaction({}) diff --git a/test/unit/tx-gas-util-test.js b/test/unit/tx-gas-util-test.js index 0e4393113..d9a12d1c3 100644 --- a/test/unit/tx-gas-util-test.js +++ b/test/unit/tx-gas-util-test.js @@ -1,12 +1,12 @@ const assert = require('assert') const TxGasUtils = require('../../app/scripts/lib/tx-gas-utils') -const { createStubbedProvider } = require('../stub/provider') +const { createTestProviderTools } = require('../stub/provider') describe('Tx Gas Util', function () { let txGasUtil, provider, providerResultStub beforeEach(function () { providerResultStub = {} - provider = createStubbedProvider(providerResultStub) + provider = createTestProviderTools({ scaffold: providerResultStub }).provider txGasUtil = new TxGasUtils({ provider, }) |