diff options
author | tmashuang <thomas.b.huang@gmail.com> | 2018-05-22 05:57:57 +0800 |
---|---|---|
committer | tmashuang <thomas.b.huang@gmail.com> | 2018-05-22 05:57:57 +0800 |
commit | 58b9afff4f3801d6d74b5311fb95060cc0a79cc1 (patch) | |
tree | c8d5a97f85fc7cf3c09a92949fdd615a082915cb /test/unit/migrations | |
parent | 554a10f17e8e6b4bc79d3e5440295d280458717a (diff) | |
parent | 08d95bbafa3f952b960124c36958edbafa57cb3d (diff) | |
download | tangerine-wallet-browser-58b9afff4f3801d6d74b5311fb95060cc0a79cc1.tar tangerine-wallet-browser-58b9afff4f3801d6d74b5311fb95060cc0a79cc1.tar.gz tangerine-wallet-browser-58b9afff4f3801d6d74b5311fb95060cc0a79cc1.tar.bz2 tangerine-wallet-browser-58b9afff4f3801d6d74b5311fb95060cc0a79cc1.tar.lz tangerine-wallet-browser-58b9afff4f3801d6d74b5311fb95060cc0a79cc1.tar.xz tangerine-wallet-browser-58b9afff4f3801d6d74b5311fb95060cc0a79cc1.tar.zst tangerine-wallet-browser-58b9afff4f3801d6d74b5311fb95060cc0a79cc1.zip |
Merge branch 'develop' into testing
Diffstat (limited to 'test/unit/migrations')
-rw-r--r-- | test/unit/migrations/026-test.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/unit/migrations/026-test.js b/test/unit/migrations/026-test.js new file mode 100644 index 000000000..b3f5470cf --- /dev/null +++ b/test/unit/migrations/026-test.js @@ -0,0 +1,41 @@ +const assert = require('assert') +const migration26 = require('../../../app/scripts/migrations/026') +const oldStorage = { + 'meta': {'version': 25}, + 'data': { + 'PreferencesController': {}, + 'KeyringController': { + 'walletNicknames': { + '0x1e77e2': 'Test Account 1', + '0x7e57e2': 'Test Account 2', + }, + }, + }, +} + +describe('migration #26', () => { + it('should move the identities from KeyringController', (done) => { + migration26.migrate(oldStorage) + .then((newStorage) => { + const identities = newStorage.data.PreferencesController.identities + assert.deepEqual(identities, { + '0x1e77e2': {name: 'Test Account 1', address: '0x1e77e2'}, + '0x7e57e2': {name: 'Test Account 2', address: '0x7e57e2'}, + }) + assert.strictEqual(newStorage.data.KeyringController.walletNicknames, undefined) + done() + }) + .catch(done) + }) + + it('should successfully migrate first time state', (done) => { + migration26.migrate({ + meta: {}, + data: require('../../../app/scripts/first-time-state'), + }) + .then((migratedData) => { + assert.equal(migratedData.meta.version, migration26.version) + done() + }).catch(done) + }) +}) |