aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/migrations/029-test.js
diff options
context:
space:
mode:
authorbrunobar79 <brunobar79@gmail.com>2018-11-21 06:44:28 +0800
committerbrunobar79 <brunobar79@gmail.com>2018-11-21 06:44:28 +0800
commit9b1df386de908ae14e0ce169f1231a0d6de77972 (patch)
treed7fc663343b7ba3c28dff0022ca018a01bea451c /test/unit/migrations/029-test.js
parentc0557b43e2c493de73c8bf74cfa9e5740c8cfd3f (diff)
parent5956f8d260270d41f1e5be53f3c058782a1ae7f4 (diff)
downloadtangerine-wallet-browser-9b1df386de908ae14e0ce169f1231a0d6de77972.tar
tangerine-wallet-browser-9b1df386de908ae14e0ce169f1231a0d6de77972.tar.gz
tangerine-wallet-browser-9b1df386de908ae14e0ce169f1231a0d6de77972.tar.bz2
tangerine-wallet-browser-9b1df386de908ae14e0ce169f1231a0d6de77972.tar.lz
tangerine-wallet-browser-9b1df386de908ae14e0ce169f1231a0d6de77972.tar.xz
tangerine-wallet-browser-9b1df386de908ae14e0ce169f1231a0d6de77972.tar.zst
tangerine-wallet-browser-9b1df386de908ae14e0ce169f1231a0d6de77972.zip
fix merge conflicts
Diffstat (limited to 'test/unit/migrations/029-test.js')
-rw-r--r--test/unit/migrations/029-test.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/unit/migrations/029-test.js b/test/unit/migrations/029-test.js
new file mode 100644
index 000000000..a2876487b
--- /dev/null
+++ b/test/unit/migrations/029-test.js
@@ -0,0 +1,38 @@
+const assert = require('assert')
+const migration29 = require('../../../app/scripts/migrations/029')
+const properTime = (new Date()).getTime()
+const storage = {
+ 'meta': {},
+ 'data': {
+ 'TransactionController': {
+ 'transactions': [
+ { 'status': 'approved', id: 1, submittedTime: 0 },
+ { 'status': 'approved', id: 2, submittedTime: properTime },
+ { 'status': 'confirmed', id: 3, submittedTime: properTime },
+ { 'status': 'submitted', id: 4, submittedTime: properTime },
+ { 'status': 'submitted', id: 5, submittedTime: 0 },
+ ],
+ },
+ },
+}
+
+describe('storage is migrated successfully where transactions that are submitted have submittedTimes', () => {
+ it('should auto fail transactions more than 12 hours old', (done) => {
+ migration29.migrate(storage)
+ .then((migratedData) => {
+ const txs = migratedData.data.TransactionController.transactions
+ const [ txMeta1 ] = txs
+ assert.equal(migratedData.meta.version, 29)
+
+ assert.equal(txMeta1.status, 'failed', 'old tx is auto failed')
+ assert(txMeta1.err.message.includes('too long'), 'error message assigned')
+
+ txs.forEach((tx) => {
+ if (tx.id === 1) return
+ assert.notEqual(tx.status, 'failed', 'other tx is not auto failed')
+ })
+
+ done()
+ }).catch(done)
+ })
+})