aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/tx-state-history-helper-test.js
diff options
context:
space:
mode:
authorChi Kei Chan <chikeichan@gmail.com>2017-09-19 02:38:39 +0800
committerGitHub <noreply@github.com>2017-09-19 02:38:39 +0800
commita190bb60437e2edcdf7b9be39e69f2d34f2b0957 (patch)
tree64d0547165cbed1af2df5eec1d856c6c1847448d /test/unit/tx-state-history-helper-test.js
parent54bbf8d8590014b92e7857f30bdc2d8f3779431a (diff)
parent162a3827c7ba418ce8180d81c54ad09d9b9560b8 (diff)
downloadtangerine-wallet-browser-a190bb60437e2edcdf7b9be39e69f2d34f2b0957.tar
tangerine-wallet-browser-a190bb60437e2edcdf7b9be39e69f2d34f2b0957.tar.gz
tangerine-wallet-browser-a190bb60437e2edcdf7b9be39e69f2d34f2b0957.tar.bz2
tangerine-wallet-browser-a190bb60437e2edcdf7b9be39e69f2d34f2b0957.tar.lz
tangerine-wallet-browser-a190bb60437e2edcdf7b9be39e69f2d34f2b0957.tar.xz
tangerine-wallet-browser-a190bb60437e2edcdf7b9be39e69f2d34f2b0957.tar.zst
tangerine-wallet-browser-a190bb60437e2edcdf7b9be39e69f2d34f2b0957.zip
Merge pull request #2116 from chikeichan/nm
[NewUI] Fix merge conflict with latest master
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')
+ })
+})