1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Add tests.

This commit is contained in:
Kevin Serrano 2017-03-24 17:21:58 -04:00
parent 30e8d25013
commit 360afacd70
No known key found for this signature in database
GPG Key ID: BF999DEFC7371BA1

View File

@ -59,6 +59,17 @@ describe('Transaction Manager', function() {
assert.equal(result[0].id, 1) assert.equal(result[0].id, 1)
}) })
it('does not override txs from other networks', function() {
var tx = { id: 1, status: 'confirmed', metamaskNetworkId: 'unit test', txParams: {} }
var tx2 = { id: 2, status: 'confirmed', metamaskNetworkId: 'another net', txParams: {} }
txManager.addTx(tx, noop)
txManager.addTx(tx2, noop)
var result = txManager.getFullTxList()
var result2 = txManager.getTxList()
assert.equal(result.length, 2, 'txs were deleted')
assert.equal(result.length, 1, 'incorrect number of txs on network.')
})
it('cuts off early txs beyond a limit', function() { it('cuts off early txs beyond a limit', function() {
const limit = txManager.txHistoryLimit const limit = txManager.txHistoryLimit
for (let i = 0; i < limit + 1; i++) { for (let i = 0; i < limit + 1; i++) {