diff --git a/app/scripts/controllers/bridge-status/validators.test.ts b/app/scripts/controllers/bridge-status/validators.test.ts index c294121dc6bf..fb2f4f904e8e 100644 --- a/app/scripts/controllers/bridge-status/validators.test.ts +++ b/app/scripts/controllers/bridge-status/validators.test.ts @@ -218,7 +218,6 @@ const BridgeTxStatusResponses = { describe('validators', () => { describe('bridgeStatusValidator', () => { - // @ts-expect-error - it.each is a function it.each([ { input: BridgeTxStatusResponses.STATUS_PENDING_VALID, diff --git a/app/scripts/controllers/encryption-public-key.test.ts b/app/scripts/controllers/encryption-public-key.test.ts index dc3550a891fb..c5764ee1628b 100644 --- a/app/scripts/controllers/encryption-public-key.test.ts +++ b/app/scripts/controllers/encryption-public-key.test.ts @@ -191,7 +191,6 @@ describe('EncryptionPublicKeyController', () => { }); describe('newRequestEncryptionPublicKey', () => { - // @ts-expect-error This function is missing from the Mocha type definitions it.each([ ['Ledger', KeyringType.ledger], ['Trezor', KeyringType.trezor], diff --git a/app/scripts/controllers/metametrics-controller.test.ts b/app/scripts/controllers/metametrics-controller.test.ts index ea597ae79dc6..65f1e991dbd6 100644 --- a/app/scripts/controllers/metametrics-controller.test.ts +++ b/app/scripts/controllers/metametrics-controller.test.ts @@ -873,7 +873,6 @@ describe('MetaMetricsController', function () { }); describe('Change Signature XXX anonymous event names', function () { - // @ts-expect-error This function is missing from the Mocha type definitions it.each([ ['Signature Requested', 'Signature Requested Anon'], ['Signature Rejected', 'Signature Rejected Anon'], diff --git a/app/scripts/lib/AccountIdentitiesPetnamesBridge.test.ts b/app/scripts/lib/AccountIdentitiesPetnamesBridge.test.ts index c17ce27d68aa..16a0a169aa23 100644 --- a/app/scripts/lib/AccountIdentitiesPetnamesBridge.test.ts +++ b/app/scripts/lib/AccountIdentitiesPetnamesBridge.test.ts @@ -204,7 +204,6 @@ describe('AccountIdentitiesPetnamesBridge', () => { }); describe('shouldSyncPetname', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each([ { origin: NameOrigin.ACCOUNT_IDENTITY, diff --git a/app/scripts/lib/approval/utils.test.ts b/app/scripts/lib/approval/utils.test.ts index fc7840faea31..8ee54593c37e 100644 --- a/app/scripts/lib/approval/utils.test.ts +++ b/app/scripts/lib/approval/utils.test.ts @@ -48,7 +48,6 @@ describe('Approval Utils', () => { ); }); - // @ts-expect-error This function is missing from the Mocha type definitions it.each([ ApprovalType.SnapDialogAlert, ApprovalType.SnapDialogPrompt, @@ -64,7 +63,6 @@ describe('Approval Utils', () => { expect(approvalController.accept).toHaveBeenCalledWith(ID_MOCK, null); }); - // @ts-expect-error This function is missing from the Mocha type definitions it.each([ ApprovalType.SnapDialogConfirmation, SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.confirmAccountCreation, @@ -81,7 +79,6 @@ describe('Approval Utils', () => { expect(approvalController.accept).toHaveBeenCalledWith(ID_MOCK, false); }); - // @ts-expect-error This function is missing from the Mocha type definitions it.each([ ApprovalType.SnapDialogAlert, ApprovalType.SnapDialogPrompt, diff --git a/app/scripts/lib/createEvmMethodsToNonEvmAccountReqFilterMiddleware.test.ts b/app/scripts/lib/createEvmMethodsToNonEvmAccountReqFilterMiddleware.test.ts index 09893ea05a5e..c52a9878a852 100644 --- a/app/scripts/lib/createEvmMethodsToNonEvmAccountReqFilterMiddleware.test.ts +++ b/app/scripts/lib/createEvmMethodsToNonEvmAccountReqFilterMiddleware.test.ts @@ -5,7 +5,10 @@ import createEvmMethodsToNonEvmAccountReqFilterMiddleware, { } from './createEvmMethodsToNonEvmAccountReqFilterMiddleware'; describe('createEvmMethodsToNonEvmAccountReqFilterMiddleware', () => { - const getMockRequest = (method: string, params: Record) => ({ + const getMockRequest = ( + method: string, + params: Record[] | undefined, + ) => ({ jsonrpc: jsonrpc2, id: 1, method, @@ -13,7 +16,6 @@ describe('createEvmMethodsToNonEvmAccountReqFilterMiddleware', () => { }); const getMockResponse = () => ({ jsonrpc: jsonrpc2, id: 'foo' }); - // @ts-expect-error This function is missing from the Mocha type definitions it.each([ // EVM requests { @@ -285,8 +287,8 @@ describe('createEvmMethodsToNonEvmAccountReqFilterMiddleware', () => { }: { accountType: EthAccountType | BtcAccountType; method: string; - params: Record; - calledNext: number; + params: Record[] | undefined; + calledNext: boolean; }) => { const filterFn = createEvmMethodsToNonEvmAccountReqFilterMiddleware({ messenger: { diff --git a/app/scripts/lib/multichain/address.test.ts b/app/scripts/lib/multichain/address.test.ts index 61dbed67629f..dc211a76d829 100644 --- a/app/scripts/lib/multichain/address.test.ts +++ b/app/scripts/lib/multichain/address.test.ts @@ -4,80 +4,63 @@ import { normalizeSafeAddress, } from './address'; -type TestAddress = { - address: string; - normalizedAddress: string; - checksumAddress: string; -}; - -const ETH_ADDRESSES = [ - // Lower-case address - { - address: '0x6431726eee67570bf6f0cf892ae0a3988f03903f', - normalizedAddress: '0x6431726eee67570bf6f0cf892ae0a3988f03903f', - checksumAddress: '0x6431726EEE67570BF6f0Cf892aE0a3988F03903F', - }, - // Checksum address - { - address: '0x6431726EEE67570BF6f0Cf892aE0a3988F03903F', - normalizedAddress: '0x6431726eee67570bf6f0cf892ae0a3988f03903f', - checksumAddress: '0x6431726EEE67570BF6f0Cf892aE0a3988F03903F', - }, -]; +describe('address', () => { + const TEST_CASES_EVM_ADDRESSES = [ + { + address: '0x6431726eee67570bf6f0cf892ae0a3988f03903f', // Lower-case address + normalizedAddress: '0x6431726eee67570bf6f0cf892ae0a3988f03903f', + checksumAddress: '0x6431726EEE67570BF6f0Cf892aE0a3988F03903F', + }, + { + address: '0x6431726EEE67570BF6f0Cf892aE0a3988F03903F', // Checksum address + normalizedAddress: '0x6431726eee67570bf6f0cf892ae0a3988f03903f', + checksumAddress: '0x6431726EEE67570BF6f0Cf892aE0a3988F03903F', + }, + ]; -const NON_EVM_ADDRESSES = [ - { - address: '0xdeadbeef', - }, - { - address: 'bc1ql49ydapnjafl5t2cp9zqpjwe6pdgmxy98859v2', - }, -]; + const TEST_CASES_NON_EVM_ADDRESSES = [ + '0xdeadbeef', + 'bc1ql49ydapnjafl5t2cp9zqpjwe6pdgmxy98859v2', + ]; -describe('address', () => { describe('isEthAddress', () => { - // @ts-expect-error This is missing from the Mocha type definitions - it.each(ETH_ADDRESSES)( + it.each(TEST_CASES_EVM_ADDRESSES)( 'returns true if address is an ethereum address: $address', - ({ address }: TestAddress) => { + ({ address }) => { expect(isEthAddress(address)).toBe(true); expect(isEthAddress(address.toLowerCase())).toBe(true); }, ); - // @ts-expect-error This is missing from the Mocha type definitions - it.each(NON_EVM_ADDRESSES)( + it.each(TEST_CASES_NON_EVM_ADDRESSES)( 'returns false if address is not an ethereum address: $address', - ({ address }: TestAddress) => { + (address) => { expect(isEthAddress(address)).toBe(false); }, ); }); describe('normalizeAddress', () => { - // @ts-expect-error This is missing from the Mocha type definitions - it.each(ETH_ADDRESSES)( + it.each(TEST_CASES_EVM_ADDRESSES)( 'normalizes address: $address', - ({ address, normalizedAddress }: TestAddress) => { + ({ address, normalizedAddress }) => { expect(normalizeAddress(address)).toBe(normalizedAddress); expect(normalizeAddress(address.toLowerCase())).toBe(normalizedAddress); }, ); - // @ts-expect-error This is missing from the Mocha type definitions - it.each(NON_EVM_ADDRESSES)( + it.each(TEST_CASES_NON_EVM_ADDRESSES)( 'returns the original address if its a non-EVM address', - ({ address }: TestAddress) => { + (address) => { expect(normalizeAddress(address)).toBe(address); }, ); }); describe('normalizeSafeAddress', () => { - // @ts-expect-error This is missing from the Mocha type definitions - it.each(ETH_ADDRESSES)( + it.each(TEST_CASES_EVM_ADDRESSES)( 'normalizes address to its "safe" form: $address to: $checksumAddress', - ({ address, checksumAddress }: TestAddress) => { + ({ address, checksumAddress }) => { expect(normalizeSafeAddress(address)).toBe(checksumAddress); expect(normalizeSafeAddress(address.toLowerCase())).toBe( checksumAddress, @@ -85,10 +68,9 @@ describe('address', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions - it.each(NON_EVM_ADDRESSES)( + it.each(TEST_CASES_NON_EVM_ADDRESSES)( 'returns the original address if its a non-EVM address', - ({ address }: TestAddress) => { + (address) => { expect(normalizeSafeAddress(address)).toBe(address); }, ); diff --git a/app/scripts/lib/ppom/ppom-util.test.ts b/app/scripts/lib/ppom/ppom-util.test.ts index 0bb1deb72c86..c30ecc135a63 100644 --- a/app/scripts/lib/ppom/ppom-util.test.ts +++ b/app/scripts/lib/ppom/ppom-util.test.ts @@ -261,7 +261,6 @@ describe('PPOM Utils', () => { ); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each([METHOD_SIGN_TYPED_DATA_V3, METHOD_SIGN_TYPED_DATA_V4])( 'sanitizes request params if method is %s', async (method: string) => { diff --git a/app/scripts/lib/rpc-method-middleware/createUnsupportedMethodMiddleware.test.ts b/app/scripts/lib/rpc-method-middleware/createUnsupportedMethodMiddleware.test.ts index 341eb1b98706..d3c285c9454c 100644 --- a/app/scripts/lib/rpc-method-middleware/createUnsupportedMethodMiddleware.test.ts +++ b/app/scripts/lib/rpc-method-middleware/createUnsupportedMethodMiddleware.test.ts @@ -21,7 +21,6 @@ describe('createUnsupportedMethodMiddleware', () => { expect(endMock).not.toHaveBeenCalled(); }); - // @ts-expect-error This function is missing from the Mocha type definitions it.each([...UNSUPPORTED_RPC_METHODS])( 'ends requests for default unsupported rpc methods when no list is provided: %s', (method: string) => { @@ -40,7 +39,6 @@ describe('createUnsupportedMethodMiddleware', () => { const unsupportedMethods = new Set(['foo', 'bar']); - // @ts-expect-error This function is missing from the Mocha type definitions it.each([...unsupportedMethods])( 'ends requests for methods that are in the provided list of unsupported methods: %s', (method: string) => { diff --git a/app/scripts/lib/rpc-method-middleware/handlers/ethereum-chain-utils.test.ts b/app/scripts/lib/rpc-method-middleware/handlers/ethereum-chain-utils.test.ts index b1ec4b8dbacf..528883b32708 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/ethereum-chain-utils.test.ts +++ b/app/scripts/lib/rpc-method-middleware/handlers/ethereum-chain-utils.test.ts @@ -253,7 +253,6 @@ describe('Ethereum Chain Utils', () => { }); }); - // @ts-expect-error This function is missing from the Mocha type definitions describe.each([ ['legacy', false], ['multichain', true], diff --git a/app/scripts/lib/rpc-method-middleware/handlers/wallet-revokePermissions.test.ts b/app/scripts/lib/rpc-method-middleware/handlers/wallet-revokePermissions.test.ts index fd14fa424a61..c945caa8737b 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/wallet-revokePermissions.test.ts +++ b/app/scripts/lib/rpc-method-middleware/handlers/wallet-revokePermissions.test.ts @@ -87,7 +87,6 @@ describe('revokePermissionsHandler', () => { ); }); - // @ts-expect-error This is missing from the Mocha type definitions describe.each([ [RestrictedMethods.eth_accounts], [PermissionNames.permittedChains], diff --git a/app/scripts/lib/snap-keyring/keyring-snaps-permissions.test.ts b/app/scripts/lib/snap-keyring/keyring-snaps-permissions.test.ts index a04b443759a1..e66739c7b47b 100644 --- a/app/scripts/lib/snap-keyring/keyring-snaps-permissions.test.ts +++ b/app/scripts/lib/snap-keyring/keyring-snaps-permissions.test.ts @@ -32,7 +32,6 @@ describe('keyringSnapPermissionsBuilder', () => { }); describe('Portfolio origin', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each(PORTFOLIO_ORIGINS)( 'returns the methods that can be called by %s', (origin: string) => { @@ -49,7 +48,6 @@ describe('keyringSnapPermissionsBuilder', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each(PORTFOLIO_ORIGINS)( '%s cannot create an account', (origin: string) => { @@ -61,7 +59,6 @@ describe('keyringSnapPermissionsBuilder', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each(PORTFOLIO_ORIGINS)('%s can submit a request', (origin: string) => { const permissions = keyringSnapPermissionsBuilder(mockController, origin); expect(permissions()).toContain(KeyringRpcMethod.SubmitRequest); @@ -113,7 +110,6 @@ describe('keyringSnapPermissionsBuilder', () => { expect(permissions()).toStrictEqual([]); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ '', 'null', @@ -139,7 +135,6 @@ describe('keyringSnapPermissionsBuilder', () => { }); describe('isProtocolAllowed', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each([ ['http://some-dapp.com', true], ['https://some-dapp.com', true], diff --git a/app/scripts/lib/snap-keyring/utils/isBlockedUrl.test.ts b/app/scripts/lib/snap-keyring/utils/isBlockedUrl.test.ts index d45adad18041..4f6d238d7077 100644 --- a/app/scripts/lib/snap-keyring/utils/isBlockedUrl.test.ts +++ b/app/scripts/lib/snap-keyring/utils/isBlockedUrl.test.ts @@ -32,7 +32,6 @@ describe('isBlockedUrl', () => { }, }); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ ['http://metamask.io', false], ['https://metamask.io', false], diff --git a/app/scripts/lib/transaction/eip5792.test.ts b/app/scripts/lib/transaction/eip5792.test.ts index e81b89582cba..b3c727d4c654 100644 --- a/app/scripts/lib/transaction/eip5792.test.ts +++ b/app/scripts/lib/transaction/eip5792.test.ts @@ -386,7 +386,6 @@ describe('EIP-5792', () => { ); }); - // @ts-expect-error This function is missing from the Mocha type definitions it.each([ TransactionStatus.approved, TransactionStatus.signed, diff --git a/app/scripts/lib/tx-verification/tx-verification-middleware.test.ts b/app/scripts/lib/tx-verification/tx-verification-middleware.test.ts index ea0aea6216d0..03b90463a71b 100644 --- a/app/scripts/lib/tx-verification/tx-verification-middleware.test.ts +++ b/app/scripts/lib/tx-verification/tx-verification-middleware.test.ts @@ -53,7 +53,6 @@ describe('tx verification middleware', () => { expect(end).not.toHaveBeenCalled(); }); - // @ts-expect-error Our test types are broken it.each([ ['null', null], ['string', 'foo'], @@ -75,29 +74,29 @@ describe('tx verification middleware', () => { 'non-"0x"-prefixed "chainId"', [{ data: 'data', from: 'from', to: 'to', value: 'value', chainId: '1' }], ], - ])( - 'ignores invalid params: %s', - (_: string, invalidParams: JsonRpcParams) => { - const middleware = createTxVerificationMiddleware( - getMockNetworkController(), - mockTrustedSigners, - ); + ])('ignores invalid params: %s', (_: string, invalidParams) => { + const middleware = createTxVerificationMiddleware( + getMockNetworkController(), + mockTrustedSigners, + ); - const { req, res, next, end } = getMiddlewareParams( - 'eth_sendTransaction', - invalidParams, - ); - middleware(req, res, next, end); + const { req, res, next, end } = getMiddlewareParams( + 'eth_sendTransaction', + invalidParams as JsonRpcParams, + ); + middleware(req, res, next, end); - expect(next).toHaveBeenCalledTimes(1); - expect(end).not.toHaveBeenCalled(); - }, - ); + expect(next).toHaveBeenCalledTimes(1); + expect(end).not.toHaveBeenCalled(); + }); - // @ts-expect-error Our test types are broken - it.each(Object.keys(FIRST_PARTY_CONTRACT_NAMES['MetaMask Bridge']))( + it.each( + Object.keys( + FIRST_PARTY_CONTRACT_NAMES[EXPERIENCES_TYPE.METAMASK_BRIDGE], + ) as Hex[], + )( 'ignores transactions that are not addressed to the bridge contract for chain %s', - (chainId: `0x${string}`) => { + (chainId) => { const middleware = createTxVerificationMiddleware( getMockNetworkController(), mockTrustedSigners, @@ -114,10 +113,9 @@ describe('tx verification middleware', () => { }, ); - // @ts-expect-error Our test types are broken - it.each(['0x11111', '0x111', '0x222222'])( + it.each(['0x11111', '0x111', '0x222222'] as Hex[])( 'ignores transactions that do not have a bridge contract deployed for chain %s', - (chainId: `0x${string}`) => { + (chainId) => { const middleware = createTxVerificationMiddleware( getMockNetworkController(), mockTrustedSigners, diff --git a/app/scripts/migrations/095.test.ts b/app/scripts/migrations/095.test.ts index 988f59b8f5f8..7af6b1502118 100644 --- a/app/scripts/migrations/095.test.ts +++ b/app/scripts/migrations/095.test.ts @@ -156,7 +156,6 @@ describe('migration #95', () => { }); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ ['undefined', undefined], ['empty', {}], diff --git a/app/scripts/migrations/121.1.test.ts b/app/scripts/migrations/121.1.test.ts index 1d2d6f9ab70e..5a39b9d519b4 100644 --- a/app/scripts/migrations/121.1.test.ts +++ b/app/scripts/migrations/121.1.test.ts @@ -212,7 +212,6 @@ describe('migration #121.1', () => { }, ]; - // @ts-expect-error 'each' function missing from type definitions, but it does exist it.each(invalidState)( 'captures error when state is invalid due to: $label', async ({ diff --git a/app/scripts/migrations/131.test.ts b/app/scripts/migrations/131.test.ts index ab359ff7283c..7614ef01dfcc 100644 --- a/app/scripts/migrations/131.test.ts +++ b/app/scripts/migrations/131.test.ts @@ -218,7 +218,6 @@ describe(`migration #${version}`, () => { }, ]; - // @ts-expect-error 'each' function missing from type definitions, but it does exist it.each(invalidState)( 'captures error when state is invalid due to: $label', async ({ diff --git a/app/scripts/migrations/133.1.test.ts b/app/scripts/migrations/133.1.test.ts index 4f1979f31a97..48ca469c7cd5 100644 --- a/app/scripts/migrations/133.1.test.ts +++ b/app/scripts/migrations/133.1.test.ts @@ -198,7 +198,6 @@ describe(`migration #${version}`, () => { }, ]; - // @ts-expect-error 'each' function is not recognized by TypeScript types it.each(invalidState)( 'captures error when state is invalid due to: $label', async ({ diff --git a/app/scripts/migrations/139.test.ts b/app/scripts/migrations/139.test.ts index 0505607c7193..bf7cc39db818 100644 --- a/app/scripts/migrations/139.test.ts +++ b/app/scripts/migrations/139.test.ts @@ -495,7 +495,6 @@ describe('migration #139', () => { }); }); - // @ts-expect-error This function is missing from the Mocha type definitions describe.each([ [ 'built-in', diff --git a/shared/lib/four-byte.test.ts b/shared/lib/four-byte.test.ts index 2909bc169279..5613f8a8da1b 100644 --- a/shared/lib/four-byte.test.ts +++ b/shared/lib/four-byte.test.ts @@ -28,15 +28,13 @@ describe('Four Byte', () => { expect(result).toStrictEqual('someOtherFunction(address,uint256)'); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each([undefined, null, '', '0x', '0X'])( 'returns undefined if four byte prefix is %s', - async (prefix: string) => { - expect(await getMethodFrom4Byte(prefix)).toBeUndefined(); + async (prefix) => { + expect(await getMethodFrom4Byte(prefix as string)).toBeUndefined(); }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ ['with hex prefix', '0x1234567'], ['without hex prefix', '1234567'], @@ -47,7 +45,6 @@ describe('Four Byte', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ ['undefined', { results: undefined }], ['object', { results: {} }], diff --git a/shared/lib/multichain/accounts.test.ts b/shared/lib/multichain/accounts.test.ts index 10b41425d5b0..9e8f15499070 100644 --- a/shared/lib/multichain/accounts.test.ts +++ b/shared/lib/multichain/accounts.test.ts @@ -27,7 +27,6 @@ const SOL_ADDRESSES = [ describe('multichain', () => { describe('isBtcMainnetAddress', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each(BTC_MAINNET_ADDRESSES)( 'returns true if address is compatible with BTC mainnet: %s', (address: string) => { @@ -35,7 +34,6 @@ describe('multichain', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each([...BTC_TESTNET_ADDRESSES, ...ETH_ADDRESSES, ...SOL_ADDRESSES])( 'returns false if address is not compatible with BTC mainnet: %s', (address: string) => { @@ -45,7 +43,6 @@ describe('multichain', () => { }); describe('isBtcTestnetAddress', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each(BTC_TESTNET_ADDRESSES)( 'returns true if address is compatible with BTC testnet: %s', (address: string) => { @@ -53,7 +50,6 @@ describe('multichain', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each([...BTC_MAINNET_ADDRESSES, ...ETH_ADDRESSES, ...SOL_ADDRESSES])( 'returns false if address is compatible with BTC testnet: %s', (address: string) => { @@ -63,7 +59,6 @@ describe('multichain', () => { }); describe('isSolanaAddress', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each(SOL_ADDRESSES)( 'returns true if address is a valid Solana address: %s', (address: string) => { @@ -77,7 +72,6 @@ describe('multichain', () => { }); describe('getChainTypeFromAddress', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each([...BTC_MAINNET_ADDRESSES, ...BTC_TESTNET_ADDRESSES])( 'returns KnownCaipNamespace.Bitcoin for bitcoin address: %s', (address: string) => { @@ -87,7 +81,6 @@ describe('multichain', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each(ETH_ADDRESSES)( 'returns KnownCaipNamespace.Ethereum for ethereum address: %s', (address: string) => { @@ -97,7 +90,6 @@ describe('multichain', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each(SOL_ADDRESSES)( 'returns KnownCaipNamespace.Solana for non-supported address: %s', (address: string) => { diff --git a/shared/lib/transaction-controller-utils.test.js b/shared/lib/transaction-controller-utils.test.js index 7cc7bc75b22f..df47ef7bb2e7 100644 --- a/shared/lib/transaction-controller-utils.test.js +++ b/shared/lib/transaction-controller-utils.test.js @@ -19,7 +19,6 @@ describe('transaction controller utils', () => { }); describe('calcTokenAmount()', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each([ // number values [0, 5, '0'], diff --git a/test/e2e/tsconfig.json b/test/e2e/tsconfig.json new file mode 100644 index 000000000000..fa85a7d6994c --- /dev/null +++ b/test/e2e/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.json", + "include": ["./**/*.js", "./**/*.ts"] +} diff --git a/tsconfig.json b/tsconfig.json index 820a583033f0..9537d75973d9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,7 +27,10 @@ "exclude": [ // don't typecheck stories, as they don't yet pass the type checker. "**/*.stories.tsx", - "**/*.stories.ts" + "**/*.stories.ts", + // E2E test specs have their own tsconfig in test/e2e/tsconfig.json + "test/e2e/**/*.js", + "test/e2e/**/*.ts" ], // this should match our node version in .nvmrc "extends": "@tsconfig/node22/tsconfig.json", diff --git a/ui/components/app/alert-system/utils.test.ts b/ui/components/app/alert-system/utils.test.ts index fea2e95d80d1..133d7b8b0362 100644 --- a/ui/components/app/alert-system/utils.test.ts +++ b/ui/components/app/alert-system/utils.test.ts @@ -37,7 +37,6 @@ describe('Utils', () => { { key: 'key 2', message: 'mocked message', severity: Severity.Danger }, ]; - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [ `when the highest severity is ${Severity.Danger}`, @@ -62,7 +61,6 @@ describe('Utils', () => { }); describe('getBannerAlertSeverity', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [Severity.Danger, 'danger'], [Severity.Warning, 'warning'], diff --git a/ui/components/app/multichain-transaction-details-modal/multichain-transaction-details-modal.test.tsx b/ui/components/app/multichain-transaction-details-modal/multichain-transaction-details-modal.test.tsx index c4245bd837c0..b3fd120540b1 100644 --- a/ui/components/app/multichain-transaction-details-modal/multichain-transaction-details-modal.test.tsx +++ b/ui/components/app/multichain-transaction-details-modal/multichain-transaction-details-modal.test.tsx @@ -197,7 +197,6 @@ describe('MultichainTransactionDetailsModal', () => { expect(mockTrackEvent).toHaveBeenCalled(); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [TransactionStatus.Confirmed, 'Confirmed'], [TransactionStatus.Unconfirmed, 'Pending'], diff --git a/ui/components/app/name/name.test.tsx b/ui/components/app/name/name.test.tsx index bdb186a9d9ad..338341b268f1 100644 --- a/ui/components/app/name/name.test.tsx +++ b/ui/components/app/name/name.test.tsx @@ -130,7 +130,6 @@ describe('Name', () => { }); describe('metrics', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each([ ['saved', ADDRESS_SAVED_NAME_MOCK, true], ['not saved', ADDRESS_NO_SAVED_NAME_MOCK, false], diff --git a/ui/components/ui/qr-code-view/qr-code-view.test.tsx b/ui/components/ui/qr-code-view/qr-code-view.test.tsx index b256e356728f..414a7f882b50 100644 --- a/ui/components/ui/qr-code-view/qr-code-view.test.tsx +++ b/ui/components/ui/qr-code-view/qr-code-view.test.tsx @@ -42,7 +42,6 @@ describe('QRCodeView', () => { expect(qrCodeImage).toBeInTheDocument(); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ { test: 'lowercased ETH address to checksummed', diff --git a/ui/hooks/bridge/useBridging.test.ts b/ui/hooks/bridge/useBridging.test.ts index 978fc1e1957c..2608285ea125 100644 --- a/ui/hooks/bridge/useBridging.test.ts +++ b/ui/hooks/bridge/useBridging.test.ts @@ -1,6 +1,9 @@ import nock from 'nock'; import { MetaMetricsSwapsEventSource } from '../../../shared/constants/metametrics'; -import { ETH_SWAPS_TOKEN_OBJECT } from '../../../shared/constants/swaps'; +import { + ETH_SWAPS_TOKEN_OBJECT, + SwapsTokenObject, +} from '../../../shared/constants/swaps'; import { renderHookWithProvider } from '../../../test/lib/render-helpers'; import { BRIDGE_API_BASE_URL } from '../../../shared/constants/bridge'; import { mockNetworkState } from '../../../test/stub/networks'; @@ -49,7 +52,6 @@ describe('useBridging', () => { .reply(200, { 'extension-config': { support: false } }); jest.clearAllMocks(); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [ 'https://portfolio.test/bridge?metamaskEntry=ext_bridge_button&metametricsId=0xtestMetaMetricsId&metricsEnabled=false&marketingEnabled=null&token=0x0000000000000000000000000000000000000000', @@ -71,7 +73,7 @@ describe('useBridging', () => { address: '0x00232f2jksdauo', balance: '0x5f5e100', string: '123', - }, + } as unknown as SwapsTokenObject, MetaMetricsSwapsEventSource.TokenView, undefined, ], @@ -79,9 +81,9 @@ describe('useBridging', () => { 'should open %s with the currently selected token: %p', ( expectedUrl: string, - token: string, + token: SwapsTokenObject, location: string, - urlSuffix: string, + urlSuffix: string | undefined, ) => { const openTabSpy = jest.spyOn(global.platform, 'openTab'); const { result } = renderUseBridging({ @@ -120,7 +122,6 @@ describe('useBridging', () => { .reply(200, { 'extension-config': { support: true } }); jest.clearAllMocks(); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [ '/cross-chain/swaps/prepare-swap-page?token=0x0000000000000000000000000000000000000000', @@ -142,7 +143,7 @@ describe('useBridging', () => { address: '0x00232f2jksdauo', balance: '0x5f5e100', string: '123', - }, + } as unknown as SwapsTokenObject, MetaMetricsSwapsEventSource.TokenView, undefined, ], @@ -150,9 +151,9 @@ describe('useBridging', () => { 'should open %s with the currently selected token: %p', ( expectedUrl: string, - token: string, + token: SwapsTokenObject, location: string, - urlSuffix: string, + urlSuffix: string | undefined, ) => { const openTabSpy = jest.spyOn(global.platform, 'openTab'); const { result } = renderUseBridging({ diff --git a/ui/hooks/ramps/useRamps/useRamps.test.tsx b/ui/hooks/ramps/useRamps/useRamps.test.tsx index a1c4101bcbcd..8aa79057e595 100644 --- a/ui/hooks/ramps/useRamps/useRamps.test.tsx +++ b/ui/hooks/ramps/useRamps/useRamps.test.tsx @@ -79,9 +79,7 @@ describe('useRamps', () => { }); }); - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - it.each(['0x1', '0x38', '0xa'])( + it.each(['0x1', '0x38', '0xa'] as Hex[])( 'should open the buy crypto URL with the currently connected chain ID', (mockChainId: Hex) => { mockStoreState = { diff --git a/ui/pages/bridge/utils/quote.test.ts b/ui/pages/bridge/utils/quote.test.ts index 480342418f8c..c71da2f03166 100644 --- a/ui/pages/bridge/utils/quote.test.ts +++ b/ui/pages/bridge/utils/quote.test.ts @@ -17,7 +17,6 @@ const ERC20_TOKEN = { const NATIVE_TOKEN = { decimals: 18, address: zeroAddress() }; describe('Bridge quote utils', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [ 'native', @@ -57,13 +56,17 @@ describe('Bridge quote utils', () => { _: string, destAsset: { decimals: number; address: string }, destTokenAmount: string, - toTokenExchangeRate: number, - usdExchangeRate: number, + toTokenExchangeRate: number | null, + usdExchangeRate: number | null, { amount, valueInCurrency, usd, - }: { amount: string; valueInCurrency: string; usd: string }, + }: { + amount: string; + valueInCurrency: string | undefined; + usd: string | undefined; + }, ) => { const result = calcToAmount( { @@ -79,7 +82,6 @@ describe('Bridge quote utils', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [ 'native', @@ -123,13 +125,17 @@ describe('Bridge quote utils', () => { _: string, srcAsset: { decimals: number; address: string }, srcTokenAmount: string, - fromTokenExchangeRate: number, - usdExchangeRate: number, + fromTokenExchangeRate: number | null, + usdExchangeRate: number | null, { amount, valueInCurrency, usd, - }: { amount: string; valueInCurrency: string; usd: string }, + }: { + amount: string; + valueInCurrency: string | undefined; + usd: string | undefined; + }, ) => { const result = calcSentAmount( { @@ -150,7 +156,6 @@ describe('Bridge quote utils', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [ 'native', @@ -254,7 +259,6 @@ describe('Bridge quote utils', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [ 'native', @@ -359,7 +363,6 @@ describe('Bridge quote utils', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [ 'available', @@ -372,9 +375,9 @@ describe('Bridge quote utils', () => { 'calcAdjustedReturn: valueInCurrency amounts are %s', ( _: string, - destTokenAmountInCurrency: BigNumber, - totalNetworkFeeInCurrency: BigNumber, - valueInCurrency: string, + destTokenAmountInCurrency: BigNumber | null, + totalNetworkFeeInCurrency: BigNumber | null, + valueInCurrency: BigNumber | null, ) => { const result = calcAdjustedReturn( { @@ -393,7 +396,6 @@ describe('Bridge quote utils', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ ['< 1', new BigNumber('100'), new BigNumber('5'), new BigNumber('0.05')], ['>= 1', new BigNumber('1'), new BigNumber('2000'), new BigNumber('2000')], @@ -404,14 +406,13 @@ describe('Bridge quote utils', () => { _: string, sentAmount: BigNumber, destTokenAmount: BigNumber, - rate: string, + rate: BigNumber, ) => { const result = calcSwapRate(sentAmount, destTokenAmount); expect(result).toStrictEqual(rate); }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ ['exact', 120, '2'], ['rounded down', 2000, '33'], diff --git a/ui/pages/confirmations/components/confirm/info/approve/edit-spending-cap-modal/edit-spending-cap-modal.test.tsx b/ui/pages/confirmations/components/confirm/info/approve/edit-spending-cap-modal/edit-spending-cap-modal.test.tsx index a9df02ad6592..686cd4e9000d 100644 --- a/ui/pages/confirmations/components/confirm/info/approve/edit-spending-cap-modal/edit-spending-cap-modal.test.tsx +++ b/ui/pages/confirmations/components/confirm/info/approve/edit-spending-cap-modal/edit-spending-cap-modal.test.tsx @@ -79,7 +79,6 @@ describe('EditSpendingCapModal', () => { }); describe('countDecimalDigits()', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each([ { numberString: '0', expectedDecimals: 0 }, { numberString: '100', expectedDecimals: 0 }, diff --git a/ui/pages/confirmations/components/confirm/info/hooks/useDecodedTransactionData.test.ts b/ui/pages/confirmations/components/confirm/info/hooks/useDecodedTransactionData.test.ts index 14ad70e323b8..6740259272bd 100644 --- a/ui/pages/confirmations/components/confirm/info/hooks/useDecodedTransactionData.test.ts +++ b/ui/pages/confirmations/components/confirm/info/hooks/useDecodedTransactionData.test.ts @@ -47,10 +47,9 @@ describe('useDecodedTransactionData', () => { jest.resetAllMocks(); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each([undefined, null, '', '0x', '0X'])( 'returns undefined if transaction data is %s', - async (data: string) => { + async (data: string | null | undefined) => { const result = await runHook( getMockConfirmStateForTransaction({ id: '123', diff --git a/ui/pages/confirmations/components/confirm/info/hooks/useIsUpgradeTransaction.test.ts b/ui/pages/confirmations/components/confirm/info/hooks/useIsUpgradeTransaction.test.ts index 544e1c411918..c1435b8eb948 100644 --- a/ui/pages/confirmations/components/confirm/info/hooks/useIsUpgradeTransaction.test.ts +++ b/ui/pages/confirmations/components/confirm/info/hooks/useIsUpgradeTransaction.test.ts @@ -44,11 +44,12 @@ describe('useIsUpgradeTransaction', () => { expect(result).toBe(true); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each([undefined, null, []] as const)( - 'returns false if authorization address is %s', - async (authorizationList: never) => { - const result = runUpgradeHook(authorizationList); + 'returns false if authorizationList is %s', + async (authorizationList) => { + const result = runUpgradeHook( + authorizationList as unknown as AuthorizationList, + ); expect(result).toBe(false); }, ); @@ -65,11 +66,12 @@ describe('useIsDowngradeTransaction', () => { expect(result).toBe(true); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each([undefined, null, []] as const)( 'returns false if authorization address is %s', - async (authorizationList: never) => { - const result = runDowngradeHook(authorizationList); + async (authorizationList) => { + const result = runDowngradeHook( + authorizationList as unknown as AuthorizationList, + ); expect(result).toBe(false); }, ); diff --git a/ui/pages/confirmations/components/simulation-details/amount-pill.test.tsx b/ui/pages/confirmations/components/simulation-details/amount-pill.test.tsx index 3da92fbd6727..0b2aa1f0448c 100644 --- a/ui/pages/confirmations/components/simulation-details/amount-pill.test.tsx +++ b/ui/pages/confirmations/components/simulation-details/amount-pill.test.tsx @@ -134,7 +134,6 @@ describe('AmountPill', () => { ]; describe('Native', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each(nativeAndErc20Cases)( 'renders the correct sign and amount for $amount', ({ @@ -150,7 +149,6 @@ describe('AmountPill', () => { }); describe('ERC20', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each(nativeAndErc20Cases)( 'renders the correct sign and amount for $amount', ({ @@ -183,7 +181,6 @@ describe('AmountPill', () => { }, ]; - // @ts-expect-error This is missing from the Mocha type definitions it.each(cases)( 'renders the token ID with just a plus or minus for $expected.text', ({ @@ -223,7 +220,6 @@ describe('AmountPill', () => { }, ]; - // @ts-expect-error This is missing from the Mocha type definitions it.each(cases)( 'renders the correct sign, amount, and token ID for $expected.text', ({ diff --git a/ui/pages/confirmations/components/simulation-details/asset-pill.test.tsx b/ui/pages/confirmations/components/simulation-details/asset-pill.test.tsx index 4dfa449a3a93..0781467740ae 100644 --- a/ui/pages/confirmations/components/simulation-details/asset-pill.test.tsx +++ b/ui/pages/confirmations/components/simulation-details/asset-pill.test.tsx @@ -48,7 +48,6 @@ describe('AssetPill', () => { }, ]; - // @ts-expect-error This is missing from the Mocha type definitions it.each(cases)( 'renders chain $chainId', ({ diff --git a/ui/pages/confirmations/components/simulation-details/fiat-display.test.tsx b/ui/pages/confirmations/components/simulation-details/fiat-display.test.tsx index 7a91ba129d6b..2f47e9139c3a 100644 --- a/ui/pages/confirmations/components/simulation-details/fiat-display.test.tsx +++ b/ui/pages/confirmations/components/simulation-details/fiat-display.test.tsx @@ -56,7 +56,6 @@ describe('FiatDisplay', () => { }); describe('IndividualFiatDisplay', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [100, '$100'], [-100, '$100'], @@ -81,7 +80,6 @@ describe('FiatDisplay', () => { }); describe('TotalFiatDisplay', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [[100, 200, FIAT_UNAVAILABLE, 300], 'Total = $600'], [[-100, -200, FIAT_UNAVAILABLE, -300], 'Total = $600'], diff --git a/ui/pages/confirmations/components/simulation-details/formatAmount.test.ts b/ui/pages/confirmations/components/simulation-details/formatAmount.test.ts index 4ae9b7ee7278..f139f8e7e3a7 100644 --- a/ui/pages/confirmations/components/simulation-details/formatAmount.test.ts +++ b/ui/pages/confirmations/components/simulation-details/formatAmount.test.ts @@ -13,7 +13,6 @@ describe('formatAmount', () => { expect(formatAmount(locale, new BigNumber(0.0000009))).toBe('<0.000001'); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [0.0000456, '0.000046'], [0.0004567, '0.000457'], @@ -27,7 +26,6 @@ describe('formatAmount', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [1.0034, '1.003'], [1.034, '1.034'], @@ -45,7 +43,7 @@ describe('formatAmount', () => { ], ])( 'formats amount greater than or equal to 1 with appropriate decimal precision (%s => %s)', - (amount: number, expected: string) => { + (amount: number | string, expected: string) => { expect(formatAmount(locale, new BigNumber(amount))).toBe(expected); }, ); diff --git a/ui/pages/confirmations/components/simulation-details/sortBalanceChanges.test.ts b/ui/pages/confirmations/components/simulation-details/sortBalanceChanges.test.ts index 9496c1855f80..9e002f7e25c1 100644 --- a/ui/pages/confirmations/components/simulation-details/sortBalanceChanges.test.ts +++ b/ui/pages/confirmations/components/simulation-details/sortBalanceChanges.test.ts @@ -13,7 +13,6 @@ describe('sortBalanceChanges', () => { asset: { standard }, } as BalanceChange); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ { criteria: 'fiat amount', diff --git a/ui/pages/confirmations/components/simulation-details/useSimulationMetrics.test.ts b/ui/pages/confirmations/components/simulation-details/useSimulationMetrics.test.ts index da1a93b92c6f..ba75b8a08606 100644 --- a/ui/pages/confirmations/components/simulation-details/useSimulationMetrics.test.ts +++ b/ui/pages/confirmations/components/simulation-details/useSimulationMetrics.test.ts @@ -167,22 +167,33 @@ describe('useSimulationMetrics', () => { jest.restoreAllMocks(); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ ['in progress', undefined, 'simulation_in_progress'], [ 'reverted', - { error: { code: SimulationErrorCode.Reverted } }, + { error: { code: SimulationErrorCode.Reverted } } as SimulationData, 'transaction_revert', ], - ['failed', { error: { message: 'testError' } }, 'failed'], - ['no changes', { tokenBalanceChanges: [] }, 'no_balance_change'], - ['changes', { tokenBalanceChanges: [{}] }, 'balance_change'], + [ + 'failed', + { error: { message: 'testError' } } as SimulationData, + 'failed', + ], + [ + 'no changes', + { tokenBalanceChanges: [] } as SimulationData, + 'no_balance_change', + ], + [ + 'changes', + { tokenBalanceChanges: [{}] } as SimulationData, + 'balance_change', + ], ])( 'with simulation response if %s', ( _: string, - simulationData: Record, + simulationData: SimulationData | undefined, simulationResponse: string, ) => { useDisplayNamesMock.mockReset(); @@ -201,7 +212,6 @@ describe('useSimulationMetrics', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ ['receiving', false, 'simulation_receiving_assets_quantity'], ['sending', true, 'simulation_sending_assets_quantity'], @@ -226,7 +236,6 @@ describe('useSimulationMetrics', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [ 'receiving ERC-20', @@ -312,7 +321,6 @@ describe('useSimulationMetrics', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [ 'receiving and available', @@ -370,7 +378,6 @@ describe('useSimulationMetrics', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [ 'receiving and native', @@ -469,7 +476,6 @@ describe('useSimulationMetrics', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ ['receiving', false, 'simulation_receiving_assets_total_value'], ['sending', true, 'simulation_sending_assets_total_value'], @@ -554,7 +560,6 @@ describe('useSimulationMetrics', () => { }); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [ 'simulation disabled', diff --git a/ui/pages/confirmations/hooks/alerts/transactions/useGasFeeLowAlerts.test.tsx b/ui/pages/confirmations/hooks/alerts/transactions/useGasFeeLowAlerts.test.tsx index c70a9683cc1b..746e792c6ec7 100644 --- a/ui/pages/confirmations/hooks/alerts/transactions/useGasFeeLowAlerts.test.tsx +++ b/ui/pages/confirmations/hooks/alerts/transactions/useGasFeeLowAlerts.test.tsx @@ -89,7 +89,6 @@ describe('useGasFeeLowAlerts', () => { ).toEqual([]); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each( Object.values(PriorityLevels).filter( (level) => level !== PriorityLevels.low, diff --git a/ui/pages/confirmations/hooks/alerts/utils.test.ts b/ui/pages/confirmations/hooks/alerts/utils.test.ts index 6f14f04800c6..f7b09ffef2be 100644 --- a/ui/pages/confirmations/hooks/alerts/utils.test.ts +++ b/ui/pages/confirmations/hooks/alerts/utils.test.ts @@ -5,14 +5,16 @@ import { getProviderAlertSeverity, normalizeProviderAlert } from './utils'; describe('Utils', () => { describe('getProviderAlertSeverity', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each([ [BlockaidResultType.Malicious, Severity.Danger], [BlockaidResultType.Warning, Severity.Warning], ['Other', Severity.Info], ])( 'maps %s to %s', - (inputSeverity: BlockaidResultType, expectedSeverity: Severity) => { + ( + inputSeverity: BlockaidResultType | string, + expectedSeverity: Severity, + ) => { expect( getProviderAlertSeverity(inputSeverity as BlockaidResultType), ).toBe(expectedSeverity); diff --git a/ui/pages/confirmations/hooks/useConfirmationAlertMetrics.test.ts b/ui/pages/confirmations/hooks/useConfirmationAlertMetrics.test.ts index 4164415a2c83..e84798084045 100644 --- a/ui/pages/confirmations/hooks/useConfirmationAlertMetrics.test.ts +++ b/ui/pages/confirmations/hooks/useConfirmationAlertMetrics.test.ts @@ -107,11 +107,16 @@ describe('useConfirmationAlertMetrics', () => { ); }); + type Action = + | 'trackAlertRender' + | 'trackInlineAlertClicked' + | 'trackAlertActionClicked'; + const testCases = [ { description: 'updates metrics properties when trackAlertRender is called', alertKey: AlertsName.GasFeeLow, - action: 'trackAlertRender', + action: 'trackAlertRender' as Action, expectedProperties: { alert_visualized: [ALERT_NAME_METRICS_MOCK], alert_visualized_count: 1, @@ -121,7 +126,7 @@ describe('useConfirmationAlertMetrics', () => { description: 'updates metrics properties when trackInlineAlertClicked is called', alertKey: AlertsName.GasFeeLow, - action: 'trackInlineAlertClicked', + action: 'trackInlineAlertClicked' as Action, expectedProperties: { alert_key_clicked: [ALERT_NAME_METRICS_MOCK], }, @@ -130,7 +135,7 @@ describe('useConfirmationAlertMetrics', () => { description: 'updates metrics properties when trackAlertActionClicked is called', alertKey: AlertsName.GasFeeLow, - action: 'trackAlertActionClicked', + action: 'trackAlertActionClicked' as Action, expectedProperties: { alert_action_clicked: [ALERT_NAME_METRICS_MOCK], }, @@ -139,7 +144,7 @@ describe('useConfirmationAlertMetrics', () => { description: 'updates metrics properties when receives alertKey as a valid UUID', alertKey: UUID_ALERT_KEY_MOCK, - action: 'trackAlertRender', + action: 'trackAlertRender' as Action, expectedProperties: { alert_visualized: [ALERTS_NAME_METRICS[AlertsName.Blockaid]], alert_visualized_count: 1, @@ -147,7 +152,6 @@ describe('useConfirmationAlertMetrics', () => { }, ]; - // @ts-expect-error This is missing from the Mocha type definitions it.each(testCases)( '$description', ({ @@ -157,10 +161,7 @@ describe('useConfirmationAlertMetrics', () => { }: { description: string; alertKey: string; - action: - | 'trackAlertRender' - | 'trackInlineAlertClicked' - | 'trackAlertActionClicked'; + action: Action; expectedProperties: Record; }) => { const finalExpectedProperties = { diff --git a/ui/pages/confirmations/hooks/useConfirmationNavigation.test.ts b/ui/pages/confirmations/hooks/useConfirmationNavigation.test.ts index 13a7d29f8c39..d0ff4b27d3aa 100644 --- a/ui/pages/confirmations/hooks/useConfirmationNavigation.test.ts +++ b/ui/pages/confirmations/hooks/useConfirmationNavigation.test.ts @@ -210,7 +210,6 @@ describe('useConfirmationNavigation', () => { expect(result.count).toBe(2); }); - // @ts-expect-error This function is missing from the Mocha type definitions it.each([ ['token', undefined], ['NFT', '123'], @@ -262,7 +261,6 @@ describe('useConfirmationNavigation', () => { ]); }); - // @ts-expect-error This function is missing from the Mocha type definitions it.each([ ['token', undefined], ['NFT', '123'], diff --git a/ui/pages/confirmations/hooks/useEIP7702Account.test.ts b/ui/pages/confirmations/hooks/useEIP7702Account.test.ts index 91d6423a5369..36c57a4a96e0 100644 --- a/ui/pages/confirmations/hooks/useEIP7702Account.test.ts +++ b/ui/pages/confirmations/hooks/useEIP7702Account.test.ts @@ -73,11 +73,10 @@ describe('useEIP7702Account', () => { expect(result).toBe(true); }); - // @ts-expect-error This function is missing from the Mocha type definitions it.each([undefined, '', '0x'])( 'returns false if code is %s', - async (code: string) => { - getCodeMock.mockResolvedValue(code); + async (code) => { + getCodeMock.mockResolvedValue(code as string); const result = await runHook().isUpgraded(ADDRESS_MOCK); expect(result).toBe(false); }, diff --git a/ui/selectors/accounts.test.ts b/ui/selectors/accounts.test.ts index 4c5b9726f1e8..c4335283a337 100644 --- a/ui/selectors/accounts.test.ts +++ b/ui/selectors/accounts.test.ts @@ -114,7 +114,6 @@ describe('Accounts Selectors', () => { }); describe('isSelectedInternalAccountEth', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each([ { type: MOCK_ACCOUNT_EOA.type, id: MOCK_ACCOUNT_EOA.id, isEth: true }, { @@ -146,7 +145,6 @@ describe('Accounts Selectors', () => { }); describe('isSelectedInternalAccountBtc', () => { - // @ts-expect-error This is missing from the Mocha type definitions it.each([ { type: MOCK_ACCOUNT_EOA.type, id: MOCK_ACCOUNT_EOA.id, isBtc: false }, { diff --git a/ui/selectors/multichain.test.ts b/ui/selectors/multichain.test.ts index bfc9f2cb08b8..d2c8b79f930c 100644 --- a/ui/selectors/multichain.test.ts +++ b/ui/selectors/multichain.test.ts @@ -267,7 +267,6 @@ describe('Multichain Selectors', () => { ); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each(['usd', 'ETH'])( "returns current currency '%s' if account is EVM", (currency: string) => { @@ -279,7 +278,6 @@ describe('Multichain Selectors', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each(['usd', 'BTC'])( "returns current currency '%s' if account is non-EVM", (currency: string) => { @@ -360,7 +358,6 @@ describe('Multichain Selectors', () => { expect(getMultichainIsMainnet(state)).toBe(false); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ { isMainnet: true, account: MOCK_ACCOUNT_BIP122_P2WPKH }, { isMainnet: false, account: MOCK_ACCOUNT_BIP122_P2WPKH_TESTNET }, @@ -387,7 +384,6 @@ describe('Multichain Selectors', () => { expect(getMultichainIsTestnet(state)).toBe(false); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each([CHAIN_IDS.SEPOLIA, CHAIN_IDS.LINEA_SEPOLIA])( 'returns true if account is EVM (testnet): %s', (chainId: Hex) => { @@ -396,7 +392,6 @@ describe('Multichain Selectors', () => { }, ); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ { isTestnet: false, account: MOCK_ACCOUNT_BIP122_P2WPKH }, { isTestnet: true, account: MOCK_ACCOUNT_BIP122_P2WPKH_TESTNET }, @@ -425,7 +420,6 @@ describe('Multichain Selectors', () => { ); }); - // @ts-expect-error This is missing from the Mocha type definitions it.each([ { network: 'mainnet',