From fd1494867acb15cf20268744e6f4f1559636c338 Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Thu, 17 Oct 2024 02:58:46 +0000 Subject: [PATCH] chore(test): json rpc request params can still be undefined --- ...ToNonEvmAccountReqFilterMiddleware.test.ts | 75 ++++++++++--------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/app/scripts/lib/createEvmMethodsToNonEvmAccountReqFilterMiddleware.test.ts b/app/scripts/lib/createEvmMethodsToNonEvmAccountReqFilterMiddleware.test.ts index 7504b8a63d60..063271a9984a 100644 --- a/app/scripts/lib/createEvmMethodsToNonEvmAccountReqFilterMiddleware.test.ts +++ b/app/scripts/lib/createEvmMethodsToNonEvmAccountReqFilterMiddleware.test.ts @@ -1,5 +1,6 @@ import { jsonrpc2, Json } from '@metamask/utils'; import { BtcAccountType, EthAccountType } from '@metamask/keyring-api'; +import type { JsonRpcParams, JsonRpcRequest } from '@metamask/utils'; import createEvmMethodsToNonEvmAccountReqFilterMiddleware, { EvmMethodsToNonEvmAccountFilterMessenger, } from './createEvmMethodsToNonEvmAccountReqFilterMiddleware'; @@ -19,85 +20,85 @@ describe('createEvmMethodsToNonEvmAccountReqFilterMiddleware', () => { { accountType: BtcAccountType.P2wpkh, method: 'eth_accounts', - params: [], + params: undefined, calledNext: false, }, { accountType: BtcAccountType.P2wpkh, method: 'eth_sendRawTransaction', - params: [], + params: undefined, calledNext: false, }, { accountType: BtcAccountType.P2wpkh, method: 'eth_sendTransaction', - params: [], + params: undefined, calledNext: false, }, { accountType: BtcAccountType.P2wpkh, method: 'eth_signTypedData', - params: [], + params: undefined, calledNext: false, }, { accountType: BtcAccountType.P2wpkh, method: 'eth_signTypedData_v1', - params: [], + params: undefined, calledNext: false, }, { accountType: BtcAccountType.P2wpkh, method: 'eth_signTypedData_v3', - params: [], + params: undefined, calledNext: false, }, { accountType: BtcAccountType.P2wpkh, method: 'eth_signTypedData_v4', - params: [], + params: undefined, calledNext: false, }, { accountType: EthAccountType.Eoa, method: 'eth_accounts', - params: [], + params: undefined, calledNext: true, }, { accountType: EthAccountType.Eoa, method: 'eth_sendRawTransaction', - params: [], + params: undefined, calledNext: true, }, { accountType: EthAccountType.Eoa, method: 'eth_sendTransaction', - params: [], + params: undefined, calledNext: true, }, { accountType: EthAccountType.Eoa, method: 'eth_signTypedData', - params: [], + params: undefined, calledNext: true, }, { accountType: EthAccountType.Eoa, method: 'eth_signTypedData_v1', - params: [], + params: undefined, calledNext: true, }, { accountType: EthAccountType.Eoa, method: 'eth_signTypedData_v3', - params: [], + params: undefined, calledNext: true, }, { accountType: EthAccountType.Eoa, method: 'eth_signTypedData_v4', - params: [], + params: undefined, calledNext: true, }, @@ -105,25 +106,25 @@ describe('createEvmMethodsToNonEvmAccountReqFilterMiddleware', () => { { accountType: BtcAccountType.P2wpkh, method: 'eth_blockNumber', - params: [], + params: undefined, calledNext: true, }, { accountType: BtcAccountType.P2wpkh, method: 'eth_chainId', - params: [], + params: undefined, calledNext: true, }, { accountType: EthAccountType.Eoa, method: 'eth_blockNumber', - params: [], + params: undefined, calledNext: true, }, { accountType: EthAccountType.Eoa, method: 'eth_chainId', - params: [], + params: undefined, calledNext: true, }, @@ -131,109 +132,109 @@ describe('createEvmMethodsToNonEvmAccountReqFilterMiddleware', () => { { accountType: BtcAccountType.P2wpkh, method: 'wallet_getSnaps', - params: [], + params: undefined, calledNext: true, }, { accountType: BtcAccountType.P2wpkh, method: 'wallet_invokeSnap', - params: [], + params: undefined, calledNext: true, }, { accountType: BtcAccountType.P2wpkh, method: 'wallet_requestSnaps', - params: [], + params: undefined, calledNext: true, }, { accountType: BtcAccountType.P2wpkh, method: 'snap_getClientStatus', - params: [], + params: undefined, calledNext: true, }, { accountType: BtcAccountType.P2wpkh, method: 'wallet_addEthereumChain', - params: [], + params: undefined, calledNext: true, }, { accountType: BtcAccountType.P2wpkh, method: 'wallet_getPermissions', - params: [], + params: undefined, calledNext: true, }, { accountType: BtcAccountType.P2wpkh, method: 'wallet_requestPermissions', - params: [], + params: undefined, calledNext: true, }, { accountType: BtcAccountType.P2wpkh, method: 'wallet_revokePermissions', - params: [], + params: undefined, calledNext: true, }, { accountType: BtcAccountType.P2wpkh, method: 'wallet_switchEthereumChain', - params: [], + params: undefined, calledNext: true, }, { accountType: EthAccountType.Eoa, method: 'wallet_getSnaps', - params: [], + params: undefined, calledNext: true, }, { accountType: EthAccountType.Eoa, method: 'wallet_invokeSnap', - params: [], + params: undefined, calledNext: true, }, { accountType: EthAccountType.Eoa, method: 'wallet_requestSnaps', - params: [], + params: undefined, calledNext: true, }, { accountType: EthAccountType.Eoa, method: 'snap_getClientStatus', - params: [], + params: undefined, calledNext: true, }, { accountType: EthAccountType.Eoa, method: 'wallet_addEthereumChain', - params: [], + params: undefined, calledNext: true, }, { accountType: EthAccountType.Eoa, method: 'wallet_getPermissions', - params: [], + params: undefined, calledNext: true, }, { accountType: EthAccountType.Eoa, method: 'wallet_requestPermissions', - params: [], + params: undefined, calledNext: true, }, { accountType: EthAccountType.Eoa, method: 'wallet_revokePermissions', - params: [], + params: undefined, calledNext: true, }, { accountType: EthAccountType.Eoa, method: 'wallet_switchEthereumChain', - params: [], + params: undefined, calledNext: true, }, @@ -297,7 +298,7 @@ describe('createEvmMethodsToNonEvmAccountReqFilterMiddleware', () => { const mockEnd = jest.fn(); filterFn( - getMockRequest(method, params), + getMockRequest(method, params) as JsonRpcRequest, getMockResponse(), mockNext, mockEnd,