Skip to content

chore(tron): type the mock snap clients in the staking and wallet service tests - #623

Open
ulissesferreira wants to merge 3 commits into
mainfrom
chore/tron-lint-suppressions-staking-wallet-tests
Open

ulissesferreira wants to merge 3 commits into
mainfrom
chore/tron-lint-suppressions-staking-wallet-tests

Conversation

@ulissesferreira

Copy link
Copy Markdown
Contributor

Description

Removes the remaining no-explicit-any / no-unsafe-* suppressions from the staking and wallet service tests by giving the mocked TronWeb clients a real structural type instead of any. Every mock still resolves the same fixtures and every assertion is unchanged, so the tests exercise exactly the same paths as before; the only non-typing edits are the redundant as any casts on already-correct asset IDs, which are simply dropped, and an as unknown as narrow cast for the deliberately-invalid asset ID / JSON-RPC request fixtures that the tests rely on.

Changes

  • packages/tron-wallet-snap/src/services/staking/StakingService.test.ts — added a MockTronWeb type (MockedFunction per transactionBuilder/trx method) and typed the transaction-expiration refresher mock's transaction parameter; dropped the redundant as any asset-ID assertions and typed the invalid asset ID as StakedCaipAssetType (no-explicit-any, no-unsafe-member-access, no-unsafe-call, no-unsafe-return, no-unnecessary-type-assertion)
  • packages/tron-wallet-snap/src/services/wallet/WalletService.test.ts — added a MockTronWeb type covering trx, utils and isAddress, typed the txJsonToPb and deriveTronKeypair mocks, replaced the as any service/factory casts with as unknown as Mocked<...>, built the user-rejection error with Object.assign instead of an any-typed local, and typed the missing-method request as JsonRpcRequest (no-explicit-any, no-unsafe-member-access, no-unsafe-call, no-unsafe-return, no-unsafe-argument, no-unnecessary-type-assertion)

Quality gates

  • yarn lint:oxlint packages/tron-wallet-snap — clean, 11 suppressions entries removed (0 left for these two files)
  • tsc --noEmit — clean
  • vitest run — 63 files / 1052 tests pass
  • oxfmt --check — clean

ulissesferreira and others added 2 commits November 18, 2026 01:44
…essions-staking-wallet-tests

# Conflicts:
#	oxlint-suppressions.json
@sonarqubecloud

Copy link
Copy Markdown

This branch was previously deployed

1 inactive (outdated) deployment
default-branch — 6ea160c7 Deployed Nov 17, 2026 by ulissesferreira via Determine whether this PR is a release PR #2387
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant