aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/tx-state-manager-test.js
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2018-05-17 05:20:08 +0800
committerGitHub <noreply@github.com>2018-05-17 05:20:08 +0800
commitf397002bf85b70ad5e8f19974f2cce3c8311c224 (patch)
treef55cd86d2c123becb2392112c2da953550e559d6 /test/unit/tx-state-manager-test.js
parent76c8cb3d7b1cbd5b5a3e48fac4b08e44ad936850 (diff)
parent44f31f9a7e212550914c7b354cdd8e69534990cb (diff)
downloadtangerine-wallet-browser-f397002bf85b70ad5e8f19974f2cce3c8311c224.tar
tangerine-wallet-browser-f397002bf85b70ad5e8f19974f2cce3c8311c224.tar.gz
tangerine-wallet-browser-f397002bf85b70ad5e8f19974f2cce3c8311c224.tar.bz2
tangerine-wallet-browser-f397002bf85b70ad5e8f19974f2cce3c8311c224.tar.lz
tangerine-wallet-browser-f397002bf85b70ad5e8f19974f2cce3c8311c224.tar.xz
tangerine-wallet-browser-f397002bf85b70ad5e8f19974f2cce3c8311c224.tar.zst
tangerine-wallet-browser-f397002bf85b70ad5e8f19974f2cce3c8311c224.zip
Merge pull request #4235 from scsaba/transaction-history-timestamps
Transaction history timestamps
Diffstat (limited to 'test/unit/tx-state-manager-test.js')
-rw-r--r--test/unit/tx-state-manager-test.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/unit/tx-state-manager-test.js b/test/unit/tx-state-manager-test.js
index e5fe68d0b..179542f90 100644
--- a/test/unit/tx-state-manager-test.js
+++ b/test/unit/tx-state-manager-test.js
@@ -176,14 +176,21 @@ describe('TransactionStateManager', function () {
assert.deepEqual(updatedTx.history[0], txStateHistoryHelper.snapshotFromTxMeta(updatedTx), 'first history item is initial state')
// modify value and updateTx
updatedTx.txParams.gasPrice = desiredGasPrice
+ const before = new Date().getTime()
txStateManager.updateTx(updatedTx)
+ const after = new Date().getTime()
// check updated value
const result = txStateManager.getTx('1')
assert.equal(result.txParams.gasPrice, desiredGasPrice, 'gas price updated')
// validate history was updated
assert.equal(result.history.length, 2, 'two history items (initial + diff)')
+ assert.equal(result.history[1].length, 1, 'two history state items (initial + diff)')
+
const expectedEntry = { op: 'replace', path: '/txParams/gasPrice', value: desiredGasPrice }
- assert.deepEqual(result.history[1], [expectedEntry], 'two history items (initial + diff)')
+ assert.deepEqual(result.history[1][0].op, expectedEntry.op, 'two history items (initial + diff) operation')
+ assert.deepEqual(result.history[1][0].path, expectedEntry.path, 'two history items (initial + diff) path')
+ assert.deepEqual(result.history[1][0].value, expectedEntry.value, 'two history items (initial + diff) value')
+ assert.ok(result.history[1][0].timestamp >= before && result.history[1][0].timestamp <= after)
})
})