mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
tx state history - test - fix format of history entries
This commit is contained in:
parent
833da191c3
commit
c9c0e6f674
@ -20,4 +20,30 @@ describe('tx-state-history-helper', function () {
|
||||
})
|
||||
})
|
||||
})
|
||||
<<<<<<< Updated upstream
|
||||
=======
|
||||
|
||||
it('replaying history does not mutate the original obj', function () {
|
||||
const initialState = { test: true, message: 'hello', value: 1 }
|
||||
const diff1 = [{
|
||||
"op": "replace",
|
||||
"path": "/message",
|
||||
"value": "haay",
|
||||
}]
|
||||
const diff2 = [{
|
||||
"op": "replace",
|
||||
"path": "/value",
|
||||
"value": 2,
|
||||
}]
|
||||
const history = [initialState, diff1, diff2]
|
||||
|
||||
const beforeStateSnapshot = JSON.stringify(initialState)
|
||||
const latestState = txStateHistoryHelper.replayHistory(history)
|
||||
const afterStateSnapshot = JSON.stringify(initialState)
|
||||
|
||||
assert.notEqual(initialState, latestState, 'initial state is not the same obj as the latest state')
|
||||
assert.equal(beforeStateSnapshot, afterStateSnapshot, 'initial state is not modified during run')
|
||||
})
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user