jwallet-web-keystore
Advanced tools
Comparing version
@@ -122,3 +122,3 @@ 'use strict'; | ||
if (account.name === accountName) { | ||
if (account.accountName === accountName) { | ||
return account; | ||
@@ -125,0 +125,0 @@ } |
{ | ||
"name": "jwallet-web-keystore", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "Library for ethereum blockchain accounts management", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,2 +8,3 @@ const should = require('should') | ||
const accountName = 'address account' | ||
const anotherAccountName = 'another address account' | ||
const updatedAccountName = 'updated address account' | ||
@@ -117,5 +118,21 @@ const accountIdLength = 36 | ||
it('setAccountName() should return unchanged account if accountName is the same', function(done) { | ||
const sameAccount = keystore.setAccountName(accountId, accountName) | ||
sameAccount.id.should.be.equal(accountId) | ||
sameAccount.accountName.should.be.equal(accountName) | ||
done() | ||
}) | ||
it('setAccountName() should throw error (account with this name exists)', function(done) { | ||
const anotherAccountId = keystore.createAccount({ | ||
password, | ||
accountName: anotherAccountName, | ||
type: 'address', | ||
privateKey: `0x${'1'.repeat(64)}`, | ||
}) | ||
try { | ||
keystore.setAccountName(accountId, accountName) | ||
keystore.setAccountName(accountId, anotherAccountName) | ||
@@ -169,3 +186,3 @@ done(new Error('Exception not thrown')) | ||
decryptedAccounts.should.be.an.Array() | ||
decryptedAccounts.length.should.be.equal(1) | ||
decryptedAccounts.length.should.be.equal(2) | ||
decryptedAccounts[0].accountName.should.be.equal(updatedAccountName) | ||
@@ -172,0 +189,0 @@ decryptedAccounts[0].privateKey.should.be.equal(privateKeyAddressPair.privateKey) |
77872
0.7%1550
0.85%