aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/config-manager-test.js28
-rw-r--r--test/unit/idStore-test.js10
-rw-r--r--test/unit/keyring-controller-test.js5
-rw-r--r--test/unit/keyrings/hd-test.js6
4 files changed, 23 insertions, 26 deletions
diff --git a/test/unit/config-manager-test.js b/test/unit/config-manager-test.js
index 6aa7146f0..206460ffb 100644
--- a/test/unit/config-manager-test.js
+++ b/test/unit/config-manager-test.js
@@ -100,31 +100,31 @@ describe('config-manager', function() {
describe('confirmation', function() {
- describe('#getConfirmed', function() {
+ describe('#getConfirmedDisclaimer', function() {
it('should return false if no previous key exists', function() {
- var result = configManager.getConfirmed()
+ var result = configManager.getConfirmedDisclaimer()
assert.ok(!result)
})
})
- describe('#setConfirmed', function() {
- it('should make getConfirmed return true once set', function() {
- assert.equal(configManager.getConfirmed(), false)
- configManager.setConfirmed(true)
- var result = configManager.getConfirmed()
+ describe('#setConfirmedDisclaimer', function() {
+ it('should make getConfirmedDisclaimer return true once set', function() {
+ assert.equal(configManager.getConfirmedDisclaimer(), false)
+ configManager.setConfirmedDisclaimer(true)
+ var result = configManager.getConfirmedDisclaimer()
assert.equal(result, true)
})
it('should be able to set false', function() {
- configManager.setConfirmed(false)
- var result = configManager.getConfirmed()
+ configManager.setConfirmedDisclaimer(false)
+ var result = configManager.getConfirmedDisclaimer()
assert.equal(result, false)
})
it('should persist to local storage', function() {
- configManager.setConfirmed(true)
+ configManager.setConfirmedDisclaimer(true)
var data = configManager.getData()
- assert.equal(data.isConfirmed, true)
+ assert.equal(data.isDisclaimerConfirmed, true)
})
})
})
@@ -153,7 +153,7 @@ describe('config-manager', function() {
rpcTarget: 'foobar'
},
}
- configManager.setConfirmed(true)
+ configManager.setConfirmedDisclaimer(true)
configManager.setConfig(testConfig)
var testWallet = {
@@ -164,7 +164,7 @@ describe('config-manager', function() {
var result = configManager.getData()
assert.equal(result.wallet.name, testWallet.name, 'wallet name is set')
assert.equal(result.config.provider.rpcTarget, testConfig.provider.rpcTarget)
- assert.equal(configManager.getConfirmed(), true)
+ assert.equal(configManager.getConfirmedDisclaimer(), true)
testConfig.provider.type = 'something else!'
configManager.setConfig(testConfig)
@@ -173,7 +173,7 @@ describe('config-manager', function() {
assert.equal(result.wallet.name, testWallet.name, 'wallet name is set')
assert.equal(result.config.provider.rpcTarget, testConfig.provider.rpcTarget)
assert.equal(result.config.provider.type, testConfig.provider.type)
- assert.equal(configManager.getConfirmed(), true)
+ assert.equal(configManager.getConfirmedDisclaimer(), true)
})
})
diff --git a/test/unit/idStore-test.js b/test/unit/idStore-test.js
index 46b3d4809..064483ba0 100644
--- a/test/unit/idStore-test.js
+++ b/test/unit/idStore-test.js
@@ -159,7 +159,7 @@ describe('IdentityStore', function() {
assert.equal(result.indexOf('0x'), 0, 'include hex prefix')
})
- it('buffers reasonably', function() {
+ it('buffers 20%', function() {
const idStore = new IdentityStore({
configManager: configManagerGen(),
ethStore: {
@@ -168,20 +168,18 @@ describe('IdentityStore', function() {
})
const gas = '0x04ee59' // Actual estimated gas example
- const tooBigOutput = '0x80674f9' // Actual bad output
const bnGas = new BN(ethUtil.stripHexPrefix(gas), 16)
- const correctBuffer = new BN('100000', 10)
+ const five = new BN('5', 10)
+ const correctBuffer = bnGas.div(five)
const correct = bnGas.add(correctBuffer)
- const tooBig = new BN(tooBigOutput, 16)
const result = idStore.addGasBuffer(gas)
const bnResult = new BN(ethUtil.stripHexPrefix(result), 16)
assert.equal(result.indexOf('0x'), 0, 'included hex prefix')
assert(bnResult.gt(bnGas), 'Estimate increased in value.')
- assert.equal(bnResult.sub(bnGas).toString(10), '100000', 'added 100k gas')
+ assert.equal(bnResult.sub(bnGas).toString(10), correctBuffer.toString(10), 'added 20% gas')
assert.equal(result, '0x' + correct.toString(16), 'Added the right amount')
- assert.notEqual(result, tooBigOutput, 'not that bad estimate')
})
})
diff --git a/test/unit/keyring-controller-test.js b/test/unit/keyring-controller-test.js
index 5f055e9ee..2527defe3 100644
--- a/test/unit/keyring-controller-test.js
+++ b/test/unit/keyring-controller-test.js
@@ -67,12 +67,12 @@ describe('KeyringController', function() {
type: 'HD Key Tree',
data: {
mnemonic: seedWords,
- n: 1,
+ numberOfAccounts: 1,
}
}
const mock = this.sinon.mock(keyringController)
- mock.expects('loadBalanceAndNickname')
+ mock.expects('getBalanceAndNickname')
.exactly(1)
var keyring = keyringController.restoreKeyring(mockSerialized)
@@ -170,4 +170,3 @@ describe('KeyringController', function() {
})
})
})
-
diff --git a/test/unit/keyrings/hd-test.js b/test/unit/keyrings/hd-test.js
index 5d7fbe3db..c22ffc913 100644
--- a/test/unit/keyrings/hd-test.js
+++ b/test/unit/keyrings/hd-test.js
@@ -19,7 +19,7 @@ describe('hd-keyring', function() {
describe('constructor', function() {
keyring = new HdKeyring({
mnemonic: sampleMnemonic,
- n: 2,
+ numberOfAccounts: 2,
})
const accounts = keyring.getAccounts()
@@ -45,7 +45,7 @@ describe('hd-keyring', function() {
describe('#serialize empty wallets.', function() {
it('serializes a new mnemonic', function() {
const output = keyring.serialize()
- assert.equal(output.n, 0)
+ assert.equal(output.numberOfAccounts, 0)
assert.equal(output.mnemonic, null)
})
})
@@ -54,7 +54,7 @@ describe('hd-keyring', function() {
it('serializes what it deserializes', function() {
keyring.deserialize({
mnemonic: sampleMnemonic,
- n: 1
+ numberOfAccounts: 1
})
assert.equal(keyring.wallets.length, 1, 'restores two accounts')
keyring.addAccounts(1)