aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-10-03 04:43:26 +0800
committerkumavis <aaron@kumavis.me>2017-10-03 04:43:26 +0800
commitc9c0e6f674c06d30794c73994c7776eb68ebedc0 (patch)
treeaeb901e76d7d2661e2aebdf4e01e20b83e74d945 /test
parent833da191c37db5b5b470c69a6d4d438ff4719fec (diff)
downloadtangerine-wallet-browser-c9c0e6f674c06d30794c73994c7776eb68ebedc0.tar
tangerine-wallet-browser-c9c0e6f674c06d30794c73994c7776eb68ebedc0.tar.gz
tangerine-wallet-browser-c9c0e6f674c06d30794c73994c7776eb68ebedc0.tar.bz2
tangerine-wallet-browser-c9c0e6f674c06d30794c73994c7776eb68ebedc0.tar.lz
tangerine-wallet-browser-c9c0e6f674c06d30794c73994c7776eb68ebedc0.tar.xz
tangerine-wallet-browser-c9c0e6f674c06d30794c73994c7776eb68ebedc0.tar.zst
tangerine-wallet-browser-c9c0e6f674c06d30794c73994c7776eb68ebedc0.zip
tx state history - test - fix format of history entries
Diffstat (limited to 'test')
-rw-r--r--test/unit/tx-state-history-helper.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/unit/tx-state-history-helper.js b/test/unit/tx-state-history-helper.js
index 5bb6c9bee..1590f83d0 100644
--- a/test/unit/tx-state-history-helper.js
+++ b/test/unit/tx-state-history-helper.js
@@ -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
})