blob: 1333d929d2795a7c7733653165dc0c32fc459119 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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)
})
})
|