aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/migrations
diff options
context:
space:
mode:
authorWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-04-19 11:33:51 +0800
committerWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-05-17 23:27:39 +0800
commit2d13fac476cfbb7b0140611dca00fa95ee8d91ab (patch)
tree1a34c0f7bbb1963ac3848f2366d1af4fe9dfadc0 /test/unit/migrations
parent50af02e74bf8967232b97a43db4f3befb6939566 (diff)
downloadtangerine-wallet-browser-2d13fac476cfbb7b0140611dca00fa95ee8d91ab.tar
tangerine-wallet-browser-2d13fac476cfbb7b0140611dca00fa95ee8d91ab.tar.gz
tangerine-wallet-browser-2d13fac476cfbb7b0140611dca00fa95ee8d91ab.tar.bz2
tangerine-wallet-browser-2d13fac476cfbb7b0140611dca00fa95ee8d91ab.tar.lz
tangerine-wallet-browser-2d13fac476cfbb7b0140611dca00fa95ee8d91ab.tar.xz
tangerine-wallet-browser-2d13fac476cfbb7b0140611dca00fa95ee8d91ab.tar.zst
tangerine-wallet-browser-2d13fac476cfbb7b0140611dca00fa95ee8d91ab.zip
Add migration to move identities from KeyringController
Diffstat (limited to 'test/unit/migrations')
-rw-r--r--test/unit/migrations/026-test.js41
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..ac0da3fb2
--- /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': 'Test Account 1',
+ '0x7e57e2': 'Test Account 2',
+ })
+ 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)
+ })
+})