diff --git a/app/scripts/controllers/app-state.js b/app/scripts/controllers/app-state.js index 1bbf4a4f8..cd477fd8d 100644 --- a/app/scripts/controllers/app-state.js +++ b/app/scripts/controllers/app-state.js @@ -452,7 +452,6 @@ export default class AppStateController extends EventEmitter { _acceptApproval() { if (!this._approvalRequestId) { - log.error('Attempted to accept missing unlock approval request'); return; } try { @@ -461,7 +460,7 @@ export default class AppStateController extends EventEmitter { this._approvalRequestId, ); } catch (error) { - log.error('Failed to accept transaction approval request', error); + log.error('Failed to unlock approval request', error); } this._approvalRequestId = null; diff --git a/app/scripts/controllers/app-state.test.js b/app/scripts/controllers/app-state.test.js index b96d39a4c..4716e30cd 100644 --- a/app/scripts/controllers/app-state.test.js +++ b/app/scripts/controllers/app-state.test.js @@ -1,10 +1,7 @@ import { ObservableStore } from '@metamask/obs-store'; -import log from 'loglevel'; import { ORIGIN_METAMASK } from '../../../shared/constants/app'; import AppStateController from './app-state'; -jest.mock('loglevel'); - let appStateController, mockStore; describe('AppStateController', () => { @@ -147,52 +144,6 @@ describe('AppStateController', () => { expect.any(String), ); }); - - it('logs if rejecting approval request throws', async () => { - appStateController._approvalRequestId = 'mock-approval-request-id'; - appStateController = new AppStateController({ - addUnlockListener: jest.fn(), - isUnlocked: jest.fn(() => true), - onInactiveTimeout: jest.fn(), - showUnlockRequest: jest.fn(), - preferencesStore: { - subscribe: jest.fn(), - getState: jest.fn(() => ({ - preferences: { - autoLockTimeLimit: 0, - }, - })), - }, - qrHardwareStore: { - subscribe: jest.fn(), - }, - messenger: { - call: jest.fn(() => { - throw new Error('mock error'); - }), - }, - }); - - appStateController.handleUnlock(); - - expect(log.error).toHaveBeenCalledTimes(1); - expect(log.error).toHaveBeenCalledWith( - 'Attempted to accept missing unlock approval request', - ); - }); - - it('returns without call messenger if no approval request in pending', async () => { - const emitSpy = jest.spyOn(appStateController, 'emit'); - - appStateController.handleUnlock(); - - expect(emitSpy).toHaveBeenCalledTimes(0); - expect(appStateController.messagingSystem.call).toHaveBeenCalledTimes(0); - expect(log.error).toHaveBeenCalledTimes(1); - expect(log.error).toHaveBeenCalledWith( - 'Attempted to accept missing unlock approval request', - ); - }); }); describe('setDefaultHomeActiveTabName', () => {