diff options
author | Frankie <frankie.diamond@gmail.com> | 2018-03-27 05:24:12 +0800 |
---|---|---|
committer | kumavis <kumavis@users.noreply.github.com> | 2018-03-27 05:24:12 +0800 |
commit | 5a61a6d57af62bd4dea8f1563a9edde6a03e439b (patch) | |
tree | 1cc6f2545964fd7ce5efe41a565603ee5b1cd7d4 /test/unit | |
parent | a6af5fad96f0848030394669c65363e8a0303ac0 (diff) | |
download | tangerine-wallet-browser-5a61a6d57af62bd4dea8f1563a9edde6a03e439b.tar tangerine-wallet-browser-5a61a6d57af62bd4dea8f1563a9edde6a03e439b.tar.gz tangerine-wallet-browser-5a61a6d57af62bd4dea8f1563a9edde6a03e439b.tar.bz2 tangerine-wallet-browser-5a61a6d57af62bd4dea8f1563a9edde6a03e439b.tar.lz tangerine-wallet-browser-5a61a6d57af62bd4dea8f1563a9edde6a03e439b.tar.xz tangerine-wallet-browser-5a61a6d57af62bd4dea8f1563a9edde6a03e439b.tar.zst tangerine-wallet-browser-5a61a6d57af62bd4dea8f1563a9edde6a03e439b.zip |
migration for adding submittedTime to the txMeta (#3727)
* test for migration 022
* write migration 022 adding submittedTime to txMetas whove been submitted
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/migrations/022-test.js | 32 |
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) + }) +}) |