aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/migrations/022-test.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-03-27 20:47:48 +0800
committerDan <danjm.com@gmail.com>2018-03-27 20:47:48 +0800
commitd2bd5687e8a1557a37947e4fd2638ed7f4b875f2 (patch)
treed98bbfba3685c243d0090ace7f4271ab4dd926dc /test/unit/migrations/022-test.js
parent4f0881e41be82de28ae6a444f54123b0ee2a04a0 (diff)
parentdac66b8ee90d5fc1d1736729d9a30b2d0bd04ca9 (diff)
downloadtangerine-wallet-browser-d2bd5687e8a1557a37947e4fd2638ed7f4b875f2.tar.gz
tangerine-wallet-browser-d2bd5687e8a1557a37947e4fd2638ed7f4b875f2.tar.zst
tangerine-wallet-browser-d2bd5687e8a1557a37947e4fd2638ed7f4b875f2.zip
Merge branch 'master' into i18n-translator-redux
Diffstat (limited to 'test/unit/migrations/022-test.js')
-rw-r--r--test/unit/migrations/022-test.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/unit/migrations/022-test.js b/test/unit/migrations/022-test.js
new file mode 100644
index 000000000..1333d929d
--- /dev/null
+++ b/test/unit/migrations/022-test.js
@@ -0,0 +1,32 @@
+const assert = require('assert')
+const migration22 = require('../../../app/scripts/migrations/022')
+const properTime = (new Date()).getTime()
+const storage = {
+ "meta": {},
+ "data": {
+ "TransactionController": {
+ "transactions": [
+ { "status": "submitted" },
+ { "status": "submitted", "submittedTime": properTime },
+ {"status": "confirmed"},
+ ]
+ },
+ },
+}
+
+describe('storage is migrated successfully where transactions that are submitted have submittedTimes', () => {
+ it('should add submittedTime key on the txMeta if appropriate', (done) => {
+ migration22.migrate(storage)
+ .then((migratedData) => {
+ const [txMeta1, txMeta2, txMeta3] = migratedData.data.TransactionController.transactions
+ assert.equal(migratedData.meta.version, 22)
+ // should have written a submitted time
+ assert(txMeta1.submittedTime)
+ // should not have written a submitted time because it already has one
+ assert.equal(txMeta2.submittedTime, properTime)
+ // should not have written a submitted time
+ assert(!txMeta3.submittedTime)
+ done()
+ }).catch(done)
+ })
+})