mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add some tests to tx-state-history-helper
This commit is contained in:
parent
34b327caf0
commit
b97a65e1d1
26
test/unit/tx-state-history-helper-test.js
Normal file
26
test/unit/tx-state-history-helper-test.js
Normal file
@ -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')
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue
Block a user