mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 10:30:04 +01:00
92971d3c87
* Update eslint-plugin-import version * Convert JS files to use ESM * Update ESLint rules to check imports * Fix test:unit:global command env * Cleanup mock-dev script
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
import assert from 'assert'
|
|
import migration22 from '../../../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)
|
|
})
|
|
})
|