aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/tx-state-history-helper-test.js
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-09-07 04:45:03 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-09-07 04:45:03 +0800
commit6c83ba762e73419c6db444dde05b3ebe31d7028e (patch)
tree0a1655190af8d8076de514452a70a8b54d27d371 /test/unit/tx-state-history-helper-test.js
parent15c12ca4bb6996f43518630ded12c0d7be2d571b (diff)
parent47340ca550cf8bc6738a6970e10b599416da3a39 (diff)
downloadtangerine-wallet-browser-6c83ba762e73419c6db444dde05b3ebe31d7028e.tar.gz
tangerine-wallet-browser-6c83ba762e73419c6db444dde05b3ebe31d7028e.tar.zst
tangerine-wallet-browser-6c83ba762e73419c6db444dde05b3ebe31d7028e.zip
Merge branch 'master' into transactionControllerRefractorPt3
Diffstat (limited to 'test/unit/tx-state-history-helper-test.js')
-rw-r--r--test/unit/tx-state-history-helper-test.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/unit/tx-state-history-helper-test.js b/test/unit/tx-state-history-helper-test.js
new file mode 100644
index 000000000..90cb10713
--- /dev/null
+++ b/test/unit/tx-state-history-helper-test.js
@@ -0,0 +1,26 @@
+const assert = require('assert')
+const clone = require('clone')
+const txStateHistoryHelper = require('../../app/scripts/lib/tx-state-history-helper')
+
+describe('deepCloneFromTxMeta', function () {
+ it('should clone deep', function () {
+ const input = {
+ foo: {
+ bar: {
+ bam: 'baz'
+ }
+ }
+ }
+ const output = txStateHistoryHelper.snapshotFromTxMeta(input)
+ assert('foo' in output, 'has a foo key')
+ assert('bar' in output.foo, 'has a bar key')
+ assert('bam' in output.foo.bar, 'has a bar key')
+ assert.equal(output.foo.bar.bam, 'baz', 'has a baz value')
+ })
+
+ it('should remove the history key', function () {
+ const input = { foo: 'bar', history: 'remembered' }
+ const output = txStateHistoryHelper.snapshotFromTxMeta(input)
+ assert(typeof output.history, 'undefined', 'should remove history')
+ })
+})