1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00

Delete unused UNLOCK_METAMASK action (#8307)

This action was never triggered in practice, as MetaMask is never
unlocked from the UI. The unlock always occurs as a result of a
background state update.
This commit is contained in:
Mark Stacey 2020-04-08 10:22:04 -03:00 committed by GitHub
parent 5b64a3d75e
commit 2e67751efe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 0 additions and 85 deletions

View File

@ -1,35 +0,0 @@
import assert from 'assert'
import * as actions from '../../../ui/app/store/actions'
import reducers from '../../../ui/app/ducks'
describe('#unlockMetamask(selectedAccount)', function () {
describe('after an error', function () {
it('clears warning', function () {
const warning = 'this is the wrong warning'
const account = 'foo_account'
const initialState = {
appState: {
warning: warning,
},
}
const resultState = reducers(initialState, actions.unlockMetamask(account))
assert.equal(resultState.appState.warning, null, 'warning nullified')
})
})
describe('going home after an error', function () {
it('clears warning', function () {
const warning = 'this is the wrong warning'
// const account = 'foo_account'
const initialState = {
appState: {
warning: warning,
},
}
const resultState = reducers(initialState, actions.goHome())
assert.equal(resultState.appState.warning, null, 'warning nullified')
})
})
})

View File

@ -144,17 +144,6 @@ describe('App State', function () {
assert.equal(state.warning, null)
})
it('unlocks Metamask', function () {
const state = reduceApp(metamaskState, {
type: actions.UNLOCK_METAMASK,
})
assert.equal(state.forgottenPassword, null)
assert.deepEqual(state.detailView, {})
assert.equal(state.transForward, true)
assert.equal(state.warning, null)
})
it('locks Metamask', function () {
const state = reduceApp(metamaskState, {
type: actions.LOCK_METAMASK,

View File

@ -9,17 +9,6 @@ describe('MetaMask Reducers', function () {
assert(initState)
})
it('unlocks MetaMask', function () {
const state = reduceMetamask({}, {
type: actions.UNLOCK_METAMASK,
value: 'test address',
})
assert.equal(state.isUnlocked, true)
assert.equal(state.isInitialized, true)
assert.equal(state.selectedAddress, 'test address')
})
it('locks MetaMask', function () {
const unlockMetaMaskState = {
isUnlocked: true,

View File

@ -159,18 +159,6 @@ export default function reduceApp (state = {}, action) {
warning: null,
}
// unlock
case actions.UNLOCK_METAMASK:
return {
...appState,
forgottenPassword: appState.forgottenPassword ? !appState.forgottenPassword : null,
detailView: {},
transForward: true,
isLoading: false,
warning: null,
}
case actions.LOCK_METAMASK:
return {
...appState,

View File

@ -56,14 +56,6 @@ export default function reduceMetamask (state = {}, action) {
case actions.UPDATE_METAMASK_STATE:
return { ...metamaskState, ...action.value }
case actions.UNLOCK_METAMASK:
return {
...metamaskState,
isUnlocked: true,
isInitialized: true,
selectedAddress: action.value,
}
case actions.LOCK_METAMASK:
return {
...metamaskState,

View File

@ -42,7 +42,6 @@ export const actionConstants = {
UNLOCK_IN_PROGRESS: 'UNLOCK_IN_PROGRESS',
UNLOCK_FAILED: 'UNLOCK_FAILED',
UNLOCK_SUCCEEDED: 'UNLOCK_SUCCEEDED',
UNLOCK_METAMASK: 'UNLOCK_METAMASK',
LOCK_METAMASK: 'LOCK_METAMASK',
// error handling
DISPLAY_WARNING: 'DISPLAY_WARNING',
@ -1260,13 +1259,6 @@ export function unlockSucceeded (message) {
}
}
export function unlockMetamask (account) {
return {
type: actionConstants.UNLOCK_METAMASK,
value: account,
}
}
export function updateMetamaskState (newState) {
return {
type: actionConstants.UPDATE_METAMASK_STATE,