aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/migrations/026-test.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-05-23 04:20:04 +0800
committerkumavis <aaron@kumavis.me>2018-05-23 04:20:04 +0800
commit3a80f3dd836889b7e4f4d4db8eaf42883623d9bf (patch)
treebcde7f3a6acbdf311bf66b70be6bfac2b3ed088a /test/unit/migrations/026-test.js
parent3084dc47d10e3e455c924e5aad0b0961c500ec8d (diff)
parentcee55b47d03006630b1dbe038c6008654ca8f674 (diff)
downloadtangerine-wallet-browser-3a80f3dd836889b7e4f4d4db8eaf42883623d9bf.tar.gz
tangerine-wallet-browser-3a80f3dd836889b7e4f4d4db8eaf42883623d9bf.tar.zst
tangerine-wallet-browser-3a80f3dd836889b7e4f4d4db8eaf42883623d9bf.zip
Merge branch 'develop' of github.com:MetaMask/metamask-extension into network-remove-provider-engine
Diffstat (limited to 'test/unit/migrations/026-test.js')
-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..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)
+ })
+})