diff options
author | frankiebee <frankie.diamond@gmail.com> | 2018-04-05 05:22:46 +0800 |
---|---|---|
committer | frankiebee <frankie.diamond@gmail.com> | 2018-04-05 05:27:28 +0800 |
commit | 8243824c6af97e9b4d44f47b783d789fcf734705 (patch) | |
tree | f0d3c268a911b03b77a9dac457e9dec39956ddd1 /test/unit | |
parent | 457a47bf62272deb257e3935a62e0ed265a49d78 (diff) | |
download | tangerine-wallet-browser-8243824c6af97e9b4d44f47b783d789fcf734705.tar tangerine-wallet-browser-8243824c6af97e9b4d44f47b783d789fcf734705.tar.gz tangerine-wallet-browser-8243824c6af97e9b4d44f47b783d789fcf734705.tar.bz2 tangerine-wallet-browser-8243824c6af97e9b4d44f47b783d789fcf734705.tar.lz tangerine-wallet-browser-8243824c6af97e9b4d44f47b783d789fcf734705.tar.xz tangerine-wallet-browser-8243824c6af97e9b4d44f47b783d789fcf734705.tar.zst tangerine-wallet-browser-8243824c6af97e9b4d44f47b783d789fcf734705.zip |
hot-fix - migrate unaproved txParams so that the from is lowercase
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/migrations/024-test.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/unit/migrations/024-test.js b/test/unit/migrations/024-test.js new file mode 100644 index 000000000..dab77d4e4 --- /dev/null +++ b/test/unit/migrations/024-test.js @@ -0,0 +1,37 @@ +const assert = require('assert') +const migration24 = require('../../../app/scripts/migrations/024') +const properTime = (new Date()).getTime() +const storage = { + "meta": {}, + "data": { + "TransactionController": { + "transactions": [ + ] + }, + }, +} + +const transactions = [] + + +while (transactions.length <= 10) { + transactions.push({ txParams: { from: '0x8aCce2391c0d510a6c5E5d8f819a678f79b7e675' }, status: 'unapproved' }) + transactions.push({ txParams: { from: '0x8aCce2391c0d510a6c5E5d8f819a678f79b7e675' }, status: 'confirmed' }) +} + + +storage.data.TransactionController.transactions = transactions + +describe('storage is migrated successfully and the txParams.from are lowercase', () => { + it('should lowercase the from for unapproved txs', (done) => { + migration24.migrate(storage) + .then((migratedData) => { + const migratedTransactions = migratedData.data.TransactionController.transactions + migratedTransactions.forEach((tx) => { + if (tx.status === 'unapproved') assert.equal(tx.txParams.from, '0x8acce2391c0d510a6c5e5d8f819a678f79b7e675') + else assert.equal(tx.txParams.from, '0x8aCce2391c0d510a6c5E5d8f819a678f79b7e675') + }) + done() + }).catch(done) + }) +}) |