1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Replicated really strange bug with test

This commit is contained in:
Dan Finlay 2016-06-30 11:30:46 -07:00
parent 179d176dc1
commit f49b6ca1dc
2 changed files with 17 additions and 2 deletions

View File

@ -152,7 +152,7 @@ ConfigManager.prototype.getCurrentRpcAddress = function () {
ConfigManager.prototype.clearWallet = function () { ConfigManager.prototype.clearWallet = function () {
var data = this.getConfig() var data = this.getConfig()
delete data.wallet delete data.wallet
this.setData(data) this.setConfig(data)
} }
ConfigManager.prototype.setData = function (data) { ConfigManager.prototype.setData = function (data) {

View File

@ -22,6 +22,7 @@ describe('config-manager', function() {
describe('#setConfirmed', function() { describe('#setConfirmed', function() {
it('should make getConfirmed return true once set', function() { it('should make getConfirmed return true once set', function() {
assert.equal(configManager.getConfirmed(), false)
configManager.setConfirmed(true) configManager.setConfirmed(true)
var result = configManager.getConfirmed() var result = configManager.getConfirmed()
assert.equal(result, true) assert.equal(result, true)
@ -41,6 +42,17 @@ describe('config-manager', function() {
}) })
}) })
describe('#clearWallet', function() {
it('should not erase confirmation', function() {
configManager.setConfirmed(true)
assert.equal(configManager.getConfirmed(), true)
configManager.clearWallet()
assert.equal(configManager.getConfirmed(), true)
})
})
describe('#setConfig', function() { describe('#setConfig', function() {
window.localStorage = {} // Hacking localStorage support into JSDom window.localStorage = {} // Hacking localStorage support into JSDom
@ -63,8 +75,9 @@ describe('config-manager', function() {
provider: { provider: {
type: 'rpc', type: 'rpc',
rpcTarget: 'foobar' rpcTarget: 'foobar'
} },
} }
configManager.setConfirmed(true)
configManager.setConfig(testConfig) configManager.setConfig(testConfig)
var testWallet = { var testWallet = {
@ -75,6 +88,7 @@ describe('config-manager', function() {
var result = configManager.getData() var result = configManager.getData()
assert.equal(result.wallet.name, testWallet.name, 'wallet name is set') 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.rpcTarget, testConfig.provider.rpcTarget)
assert.equal(configManager.getConfirmed(), true)
testConfig.provider.type = 'something else!' testConfig.provider.type = 'something else!'
configManager.setConfig(testConfig) configManager.setConfig(testConfig)
@ -83,6 +97,7 @@ describe('config-manager', function() {
assert.equal(result.wallet.name, testWallet.name, 'wallet name is set') 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.rpcTarget, testConfig.provider.rpcTarget)
assert.equal(result.config.provider.type, testConfig.provider.type) assert.equal(result.config.provider.type, testConfig.provider.type)
assert.equal(configManager.getConfirmed(), true)
}) })
}) })