diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-08-29 02:40:28 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-08-29 02:40:28 +0800 |
commit | b97a65e1d1e421a09bc219167de189e0a6d2e340 (patch) | |
tree | 5de9f4c813b1bd8e84af4142bed5b2b99fd5cca0 /test | |
parent | 34b327caf07cd395229806cedecdeb770c034562 (diff) | |
download | tangerine-wallet-browser-b97a65e1d1e421a09bc219167de189e0a6d2e340.tar tangerine-wallet-browser-b97a65e1d1e421a09bc219167de189e0a6d2e340.tar.gz tangerine-wallet-browser-b97a65e1d1e421a09bc219167de189e0a6d2e340.tar.bz2 tangerine-wallet-browser-b97a65e1d1e421a09bc219167de189e0a6d2e340.tar.lz tangerine-wallet-browser-b97a65e1d1e421a09bc219167de189e0a6d2e340.tar.xz tangerine-wallet-browser-b97a65e1d1e421a09bc219167de189e0a6d2e340.tar.zst tangerine-wallet-browser-b97a65e1d1e421a09bc219167de189e0a6d2e340.zip |
Add some tests to tx-state-history-helper
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/tx-state-history-helper-test.js | 26 |
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') + }) +}) |