aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKevin Serrano <kevin.serrano@consensys.net>2017-05-17 07:28:57 +0800
committerKevin Serrano <kevin.serrano@consensys.net>2017-05-17 07:28:57 +0800
commit90bfa3cbcdbe0ace28bb25ecb350b1080a4139d4 (patch)
tree3739c65edfe8a7c4e7eca455d2f1a522176e3af7 /test
parent44f25cd93c18c57acf993ace3387a4d569d8dcca (diff)
parent43ea223c9fe8ee593a572b153defc5ddefd72e95 (diff)
downloadtangerine-wallet-browser-90bfa3cbcdbe0ace28bb25ecb350b1080a4139d4.tar
tangerine-wallet-browser-90bfa3cbcdbe0ace28bb25ecb350b1080a4139d4.tar.gz
tangerine-wallet-browser-90bfa3cbcdbe0ace28bb25ecb350b1080a4139d4.tar.bz2
tangerine-wallet-browser-90bfa3cbcdbe0ace28bb25ecb350b1080a4139d4.tar.lz
tangerine-wallet-browser-90bfa3cbcdbe0ace28bb25ecb350b1080a4139d4.tar.xz
tangerine-wallet-browser-90bfa3cbcdbe0ace28bb25ecb350b1080a4139d4.tar.zst
tangerine-wallet-browser-90bfa3cbcdbe0ace28bb25ecb350b1080a4139d4.zip
Fix merge conflicts.
Diffstat (limited to 'test')
-rw-r--r--test/lib/migrations/001.json15
-rw-r--r--test/lib/mock-store.js18
-rw-r--r--test/unit/components/pending-tx-test.js89
-rw-r--r--test/unit/migrations-test.js6
-rw-r--r--test/unit/tx-controller-test.js (renamed from test/unit/tx-manager-test.js)108
5 files changed, 181 insertions, 55 deletions
diff --git a/test/lib/migrations/001.json b/test/lib/migrations/001.json
index 2fe6dd836..7bd55a50e 100644
--- a/test/lib/migrations/001.json
+++ b/test/lib/migrations/001.json
@@ -1 +1,14 @@
-{"version":0,"data":{"wallet":"{\"encSeed\":{\"encStr\":\"rT1C1jjkFRfmrwefscFcwZohl4f+HfIFlBZ9AM4ZD8atJmfKDIQCVK11NYDKYv8ZMIY03f3t8MuoZvfzBL8IJsWnZUhpzVTNNiARQJD2WpGA19eNBzgZm4vd0GwkIUruUDeJXu0iv2j9wU8hOQUqPbOePPy2Am5ro97iuvMAroRTnEKD60qFVg==\",\"nonce\":\"YUY2mwNq2v3FV0Fi94QnSiKFOLYfDR95\"},\"ksData\":{\"m/44'/60'/0'/0\":{\"info\":{\"curve\":\"secp256k1\",\"purpose\":\"sign\"},\"encHdPathPriv\":{\"encStr\":\"Iyi7ft4JQ9UtwrSXRT6ZIHPtZqJhe99rh0uWhNc6QLan6GanY2ZQeU0tt76CBealEWJyrJReSxGQdqDmSDYjpjH3m4JO5l0DfPLPseCqzXV/W+dzM0ubJ8lztLwpwi0L+vULNMqCx4dQtoNbNBq1QZUnjtpm6O8mWpScspboww==\",\"nonce\":\"Z7RqtjNjC6FrLUj5wVW1+HkjOW6Hib6K\"},\"hdIndex\":3,\"encPrivKeys\":{\"edb81c10122f34040cc4bef719a272fbbb1cf897\":{\"key\":\"8ab81tKBd4+CLAbzvS7SBFRTd6VWXBs86uBE43lgcmBu2U7UB22xdH64Q2hUf9eB\",\"nonce\":\"aGUEqI033FY39zKjWmZSI6PQrCLvkiRP\"},\"8bd7d5c000cf05284e98356370dc5ccaa3dbfc38\":{\"key\":\"+i3wmf4b+B898QtlOBfL0Ixirjg59/LLPX61vQ2L0xRPjXzNog0O4Wn15RemM5mY\",\"nonce\":\"imKrlkuoC5uuFkzJBbuDBluGCPJXNTKm\"},\"2340695474656e3124b8eba1172fbfb00eeac8f8\":{\"key\":\"pi+H9D8LYKsdCQKrfaJtsGFjE+X9s74xN675tsoIKrbPXhtpxMLOIQVtSqYveF62\",\"nonce\":\"49g80wDTovHwbguVVYf2FsYbp7Db5OAR\"}},\"addresses\":[\"edb81c10122f34040cc4bef719a272fbbb1cf897\",\"8bd7d5c000cf05284e98356370dc5ccaa3dbfc38\",\"2340695474656e3124b8eba1172fbfb00eeac8f8\"]}},\"version\":2}","config":{"provider":{"type":"etherscan"}}},"meta":{"version":0}} \ No newline at end of file
+{
+ "version": 0,
+ "data": {
+ "wallet": "{\"encSeed\":{\"encStr\":\"rT1C1jjkFRfmrwefscFcwZohl4f+HfIFlBZ9AM4ZD8atJmfKDIQCVK11NYDKYv8ZMIY03f3t8MuoZvfzBL8IJsWnZUhpzVTNNiARQJD2WpGA19eNBzgZm4vd0GwkIUruUDeJXu0iv2j9wU8hOQUqPbOePPy2Am5ro97iuvMAroRTnEKD60qFVg==\",\"nonce\":\"YUY2mwNq2v3FV0Fi94QnSiKFOLYfDR95\"},\"ksData\":{\"m/44'/60'/0'/0\":{\"info\":{\"curve\":\"secp256k1\",\"purpose\":\"sign\"},\"encHdPathPriv\":{\"encStr\":\"Iyi7ft4JQ9UtwrSXRT6ZIHPtZqJhe99rh0uWhNc6QLan6GanY2ZQeU0tt76CBealEWJyrJReSxGQdqDmSDYjpjH3m4JO5l0DfPLPseCqzXV/W+dzM0ubJ8lztLwpwi0L+vULNMqCx4dQtoNbNBq1QZUnjtpm6O8mWpScspboww==\",\"nonce\":\"Z7RqtjNjC6FrLUj5wVW1+HkjOW6Hib6K\"},\"hdIndex\":3,\"encPrivKeys\":{\"edb81c10122f34040cc4bef719a272fbbb1cf897\":{\"key\":\"8ab81tKBd4+CLAbzvS7SBFRTd6VWXBs86uBE43lgcmBu2U7UB22xdH64Q2hUf9eB\",\"nonce\":\"aGUEqI033FY39zKjWmZSI6PQrCLvkiRP\"},\"8bd7d5c000cf05284e98356370dc5ccaa3dbfc38\":{\"key\":\"+i3wmf4b+B898QtlOBfL0Ixirjg59/LLPX61vQ2L0xRPjXzNog0O4Wn15RemM5mY\",\"nonce\":\"imKrlkuoC5uuFkzJBbuDBluGCPJXNTKm\"},\"2340695474656e3124b8eba1172fbfb00eeac8f8\":{\"key\":\"pi+H9D8LYKsdCQKrfaJtsGFjE+X9s74xN675tsoIKrbPXhtpxMLOIQVtSqYveF62\",\"nonce\":\"49g80wDTovHwbguVVYf2FsYbp7Db5OAR\"}},\"addresses\":[\"edb81c10122f34040cc4bef719a272fbbb1cf897\",\"8bd7d5c000cf05284e98356370dc5ccaa3dbfc38\",\"2340695474656e3124b8eba1172fbfb00eeac8f8\"]}},\"version\":2}",
+ "config": {
+ "provider": {
+ "type": "etherscan"
+ }
+ }
+ },
+ "meta": {
+ "version": 0
+ }
+} \ No newline at end of file
diff --git a/test/lib/mock-store.js b/test/lib/mock-store.js
new file mode 100644
index 000000000..4714c3485
--- /dev/null
+++ b/test/lib/mock-store.js
@@ -0,0 +1,18 @@
+const createStore = require('redux').createStore
+const applyMiddleware = require('redux').applyMiddleware
+const thunkMiddleware = require('redux-thunk')
+const createLogger = require('redux-logger')
+const rootReducer = function() {}
+
+module.exports = configureStore
+
+const loggerMiddleware = createLogger()
+
+const createStoreWithMiddleware = applyMiddleware(
+ thunkMiddleware,
+ loggerMiddleware
+)(createStore)
+
+function configureStore (initialState) {
+ return createStoreWithMiddleware(rootReducer, initialState)
+}
diff --git a/test/unit/components/pending-tx-test.js b/test/unit/components/pending-tx-test.js
new file mode 100644
index 000000000..fe8290003
--- /dev/null
+++ b/test/unit/components/pending-tx-test.js
@@ -0,0 +1,89 @@
+const assert = require('assert')
+const additions = require('react-testutils-additions')
+const h = require('react-hyperscript')
+const PendingTx = require('../../../ui/app/components/pending-tx')
+const createReactFactory = require('create-react-factory').createReactFactory
+const React = require('react')
+const shallow = require('react-test-renderer/shallow')
+const Factory = createReactFactory(PendingTx)
+const ReactTestUtils = require('react-addons-test-utils')
+const ethUtil = require('ethereumjs-util')
+
+describe.only('PendingTx', function () {
+ let pendingTxComponent
+
+ const identities = {
+ '0xfdea65c8e26263f6d9a1b5de9555d2931a33b826': {
+ name: 'Main Account 1',
+ balance: '0x00000000000000056bc75e2d63100000',
+ },
+ }
+
+ const gasPrice = '0x4A817C800' // 20 Gwei
+ const txData = {
+ 'id':5021615666270214,
+ 'time':1494458763011,
+ 'status':'unapproved',
+ 'metamaskNetworkId':'1494442339676',
+ 'txParams':{
+ 'from':'0xfdea65c8e26263f6d9a1b5de9555d2931a33b826',
+ 'to':'0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb',
+ 'value':'0xde0b6b3a7640000',
+ gasPrice,
+ 'gas':'0x7b0c'},
+ 'gasLimitSpecified':false,
+ 'estimatedGas':'0x5208',
+ }
+
+
+ it('should use updated values when edited.', function (done) {
+
+ const renderer = ReactTestUtils.createRenderer();
+ const newGasPrice = '0x77359400'
+
+ const props = {
+ identities,
+ accounts: identities,
+ txData,
+ sendTransaction: (txMeta, event) => {
+
+ // Assert changes:
+ const result = ethUtil.addHexPrefix(txMeta.txParams.gasPrice)
+ assert.notEqual(result, gasPrice, 'gas price should change')
+ assert.equal(result, newGasPrice, 'gas price assigned.')
+ done()
+ },
+ }
+
+ const pendingTxComponent = h(PendingTx, props)
+ const component = additions.renderIntoDocument(pendingTxComponent);
+ renderer.render(pendingTxComponent)
+ const result = renderer.getRenderOutput()
+ const form = result.props.children
+ const children = form.props.children[form.props.children.length - 1]
+ assert.equal(result.type, 'div', 'should create a div')
+
+ try{
+
+ const input = additions.find(component, '.cell.row input[type="number"]')[1]
+ ReactTestUtils.Simulate.change(input, {
+ target: {
+ value: 2,
+ checkValidity() { return true },
+ }
+ })
+
+ let form = additions.find(component, 'form')[0]
+ form.checkValidity = () => true
+ form.getFormEl = () => { return { checkValidity() { return true } } }
+ ReactTestUtils.Simulate.submit(form, { preventDefault() {}, target: { checkValidity() {return true} } })
+
+ } catch (e) {
+ console.log("WHAAAA")
+ console.error(e)
+ }
+
+ })
+
+})
+
diff --git a/test/unit/migrations-test.js b/test/unit/migrations-test.js
index 324e4d056..5bad25a45 100644
--- a/test/unit/migrations-test.js
+++ b/test/unit/migrations-test.js
@@ -16,6 +16,7 @@ const migration9 = require(path.join('..', '..', 'app', 'scripts', 'migrations',
const migration10 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '010'))
const migration11 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '011'))
const migration12 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '012'))
+const migration13 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '013'))
const oldTestRpc = 'https://rawtestrpc.metamask.io/'
@@ -97,6 +98,11 @@ describe('wallet1 is migrated successfully', () => {
}).then((twelfthResult) => {
assert.equal(twelfthResult.data.NoticeController.noticesList[0].body, '', 'notices that have been read should have an empty body.')
assert.equal(twelfthResult.data.NoticeController.noticesList[1].body, 'nonempty', 'notices that have not been read should not have an empty body.')
+
+ assert.equal(twelfthResult.data.config.provider.type, 'testnet', 'network is originally testnet.')
+ return migration13.migrate(twelfthResult)
+ }).then((thirteenthResult) => {
+ assert.equal(thirteenthResult.data.config.provider.type, 'ropsten', 'network has been changed to ropsten.')
})
})
})
diff --git a/test/unit/tx-manager-test.js b/test/unit/tx-controller-test.js
index b5d148723..d0b32ff41 100644
--- a/test/unit/tx-manager-test.js
+++ b/test/unit/tx-controller-test.js
@@ -3,17 +3,17 @@ const EventEmitter = require('events')
const ethUtil = require('ethereumjs-util')
const EthTx = require('ethereumjs-tx')
const ObservableStore = require('obs-store')
-const TransactionManager = require('../../app/scripts/transaction-manager')
+const TransactionController = require('../../app/scripts/controllers/transactions')
const noop = () => true
const currentNetworkId = 42
const otherNetworkId = 36
const privKey = new Buffer('8718b9618a37d1fc78c436511fc6df3c8258d3250635bba617f33003270ec03e', 'hex')
describe('Transaction Manager', function () {
- let txManager
+ let txController
beforeEach(function () {
- txManager = new TransactionManager({
+ txController = new TransactionController({
networkStore: new ObservableStore({ network: currentNetworkId }),
txHistoryLimit: 10,
blockTracker: new EventEmitter(),
@@ -29,7 +29,7 @@ describe('Transaction Manager', function () {
var sample = {
value: '0x01',
}
- txManager.txProviderUtils.validateTxParams(sample, (err) => {
+ txController.txProviderUtils.validateTxParams(sample, (err) => {
assert.equal(err, null, 'no error')
})
})
@@ -38,7 +38,7 @@ describe('Transaction Manager', function () {
var sample = {
value: '-0x01',
}
- txManager.txProviderUtils.validateTxParams(sample, (err) => {
+ txController.txProviderUtils.validateTxParams(sample, (err) => {
assert.ok(err, 'error')
})
})
@@ -46,7 +46,7 @@ describe('Transaction Manager', function () {
describe('#getTxList', function () {
it('when new should return empty array', function () {
- var result = txManager.getTxList()
+ var result = txController.getTxList()
assert.ok(Array.isArray(result))
assert.equal(result.length, 0)
})
@@ -58,8 +58,8 @@ describe('Transaction Manager', function () {
describe('#addTx', function () {
it('adds a tx returned in getTxList', function () {
var tx = { id: 1, status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }
- txManager.addTx(tx, noop)
- var result = txManager.getTxList()
+ txController.addTx(tx, noop)
+ var result = txController.getTxList()
assert.ok(Array.isArray(result))
assert.equal(result.length, 1)
assert.equal(result[0].id, 1)
@@ -68,45 +68,45 @@ describe('Transaction Manager', function () {
it('does not override txs from other networks', function () {
var tx = { id: 1, status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }
var tx2 = { id: 2, status: 'confirmed', metamaskNetworkId: otherNetworkId, txParams: {} }
- txManager.addTx(tx, noop)
- txManager.addTx(tx2, noop)
- var result = txManager.getFullTxList()
- var result2 = txManager.getTxList()
+ txController.addTx(tx, noop)
+ txController.addTx(tx2, noop)
+ var result = txController.getFullTxList()
+ var result2 = txController.getTxList()
assert.equal(result.length, 2, 'txs were deleted')
assert.equal(result2.length, 1, 'incorrect number of txs on network.')
})
it('cuts off early txs beyond a limit', function () {
- const limit = txManager.txHistoryLimit
+ const limit = txController.txHistoryLimit
for (let i = 0; i < limit + 1; i++) {
const tx = { id: i, time: new Date(), status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }
- txManager.addTx(tx, noop)
+ txController.addTx(tx, noop)
}
- var result = txManager.getTxList()
+ var result = txController.getTxList()
assert.equal(result.length, limit, `limit of ${limit} txs enforced`)
assert.equal(result[0].id, 1, 'early txs truncted')
})
it('cuts off early txs beyond a limit whether or not it is confirmed or rejected', function () {
- const limit = txManager.txHistoryLimit
+ const limit = txController.txHistoryLimit
for (let i = 0; i < limit + 1; i++) {
const tx = { id: i, time: new Date(), status: 'rejected', metamaskNetworkId: currentNetworkId, txParams: {} }
- txManager.addTx(tx, noop)
+ txController.addTx(tx, noop)
}
- var result = txManager.getTxList()
+ var result = txController.getTxList()
assert.equal(result.length, limit, `limit of ${limit} txs enforced`)
assert.equal(result[0].id, 1, 'early txs truncted')
})
it('cuts off early txs beyond a limit but does not cut unapproved txs', function () {
var unconfirmedTx = { id: 0, time: new Date(), status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }
- txManager.addTx(unconfirmedTx, noop)
- const limit = txManager.txHistoryLimit
+ txController.addTx(unconfirmedTx, noop)
+ const limit = txController.txHistoryLimit
for (let i = 1; i < limit + 1; i++) {
const tx = { id: i, time: new Date(), status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }
- txManager.addTx(tx, noop)
+ txController.addTx(tx, noop)
}
- var result = txManager.getTxList()
+ var result = txController.getTxList()
assert.equal(result.length, limit, `limit of ${limit} txs enforced`)
assert.equal(result[0].id, 0, 'first tx should still be there')
assert.equal(result[0].status, 'unapproved', 'first tx should be unapproved')
@@ -117,9 +117,9 @@ describe('Transaction Manager', function () {
describe('#setTxStatusSigned', function () {
it('sets the tx status to signed', function () {
var tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }
- txManager.addTx(tx, noop)
- txManager.setTxStatusSigned(1)
- var result = txManager.getTxList()
+ txController.addTx(tx, noop)
+ txController.setTxStatusSigned(1)
+ var result = txController.getTxList()
assert.ok(Array.isArray(result))
assert.equal(result.length, 1)
assert.equal(result[0].status, 'signed')
@@ -132,18 +132,18 @@ describe('Transaction Manager', function () {
assert(true, 'event listener has been triggered and noop executed')
done()
}
- txManager.addTx(tx)
- txManager.on('1:signed', noop)
- txManager.setTxStatusSigned(1)
+ txController.addTx(tx)
+ txController.on('1:signed', noop)
+ txController.setTxStatusSigned(1)
})
})
describe('#setTxStatusRejected', function () {
it('sets the tx status to rejected', function () {
var tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }
- txManager.addTx(tx)
- txManager.setTxStatusRejected(1)
- var result = txManager.getTxList()
+ txController.addTx(tx)
+ txController.setTxStatusRejected(1)
+ var result = txController.getTxList()
assert.ok(Array.isArray(result))
assert.equal(result.length, 1)
assert.equal(result[0].status, 'rejected')
@@ -152,31 +152,31 @@ describe('Transaction Manager', function () {
it('should emit a rejected event to signal the exciton of callback', (done) => {
this.timeout(10000)
var tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }
- txManager.addTx(tx)
+ txController.addTx(tx)
const noop = function (err, txId) {
assert(true, 'event listener has been triggered and noop executed')
done()
}
- txManager.on('1:rejected', noop)
- txManager.setTxStatusRejected(1)
+ txController.on('1:rejected', noop)
+ txController.setTxStatusRejected(1)
})
})
describe('#updateTx', function () {
it('replaces the tx with the same id', function () {
- txManager.addTx({ id: '1', status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
- txManager.addTx({ id: '2', status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
- txManager.updateTx({ id: '1', status: 'blah', hash: 'foo', metamaskNetworkId: currentNetworkId, txParams: {} })
- var result = txManager.getTx('1')
+ txController.addTx({ id: '1', status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
+ txController.addTx({ id: '2', status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
+ txController.updateTx({ id: '1', status: 'blah', hash: 'foo', metamaskNetworkId: currentNetworkId, txParams: {} })
+ var result = txController.getTx('1')
assert.equal(result.hash, 'foo')
})
})
describe('#getUnapprovedTxList', function () {
it('returns unapproved txs in a hash', function () {
- txManager.addTx({ id: '1', status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
- txManager.addTx({ id: '2', status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
- const result = txManager.getUnapprovedTxList()
+ txController.addTx({ id: '1', status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
+ txController.addTx({ id: '2', status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
+ const result = txController.getUnapprovedTxList()
assert.equal(typeof result, 'object')
assert.equal(result['1'].status, 'unapproved')
assert.equal(result['2'], undefined)
@@ -185,10 +185,10 @@ describe('Transaction Manager', function () {
describe('#getTx', function () {
it('returns a tx with the requested id', function () {
- txManager.addTx({ id: '1', status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
- txManager.addTx({ id: '2', status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
- assert.equal(txManager.getTx('1').status, 'unapproved')
- assert.equal(txManager.getTx('2').status, 'confirmed')
+ txController.addTx({ id: '1', status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
+ txController.addTx({ id: '2', status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
+ assert.equal(txController.getTx('1').status, 'unapproved')
+ assert.equal(txController.getTx('2').status, 'confirmed')
})
})
@@ -206,28 +206,28 @@ describe('Transaction Manager', function () {
{ id: 8, status: 'confirmed', txParams: { from: '0xbb', to: '0xaa' }, metamaskNetworkId: currentNetworkId },
{ id: 9, status: 'confirmed', txParams: { from: '0xbb', to: '0xaa' }, metamaskNetworkId: currentNetworkId },
]
- txMetas.forEach((txMeta) => txManager.addTx(txMeta, noop))
+ txMetas.forEach((txMeta) => txController.addTx(txMeta, noop))
let filterParams
filterParams = { status: 'unapproved', from: '0xaa' }
- assert.equal(txManager.getFilteredTxList(filterParams).length, 3, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
+ assert.equal(txController.getFilteredTxList(filterParams).length, 3, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
filterParams = { status: 'unapproved', to: '0xaa' }
- assert.equal(txManager.getFilteredTxList(filterParams).length, 2, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
+ assert.equal(txController.getFilteredTxList(filterParams).length, 2, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
filterParams = { status: 'confirmed', from: '0xbb' }
- assert.equal(txManager.getFilteredTxList(filterParams).length, 3, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
+ assert.equal(txController.getFilteredTxList(filterParams).length, 3, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
filterParams = { status: 'confirmed' }
- assert.equal(txManager.getFilteredTxList(filterParams).length, 5, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
+ assert.equal(txController.getFilteredTxList(filterParams).length, 5, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
filterParams = { from: '0xaa' }
- assert.equal(txManager.getFilteredTxList(filterParams).length, 5, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
+ assert.equal(txController.getFilteredTxList(filterParams).length, 5, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
filterParams = { to: '0xaa' }
- assert.equal(txManager.getFilteredTxList(filterParams).length, 5, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
+ assert.equal(txController.getFilteredTxList(filterParams).length, 5, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
})
})
describe('#sign replay-protected tx', function () {
it('prepares a tx with the chainId set', function () {
- txManager.addTx({ id: '1', status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
- txManager.signTransaction('1', (err, rawTx) => {
+ txController.addTx({ id: '1', status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
+ txController.signTransaction('1', (err, rawTx) => {
if (err) return assert.fail('it should not fail')
const ethTx = new EthTx(ethUtil.toBuffer(rawTx))
assert.equal(ethTx.getChainId(), currentNetworkId)