Repository navigation
chore(bitcoin): type the Bitcoin handler test fixtures - #640
Open
ulissesferreira wants to merge 3 commits into
Open
ulissesferreira wants to merge 3 commits into
ulissesferreira wants to merge 3 commits into
Conversation
ulissesferreira
temporarily deployed
to
default-branch
November 17, 2026 02:30 — with
GitHub Actions
Inactive
…ppressions-handler-tests # Conflicts: # oxlint-suppressions.json
|
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Types the Bitcoin snap handler test fixtures instead of leaving them
any, clearing all 83 oxlint violations recorded for these seven handler test files (21file -> ruleentries):typescript/no-explicit-any(29),no-unsafe-return(15),no-unnecessary-type-assertion(14),no-unsafe-member-access(11),explicit-function-return-type(8),vitest/no-conditional-in-test(3),no-unsafe-argument(2) andid-length(1). The change is behaviour-neutral: mockAddressvalues are cast to the realAddresstype instead ofany, partially-stubbedBalancefixtures are cast toBalance, the fourparamsliterals that deliberately omit a field drop an unnecessaryas any(they already satisfyJsonRpcRequest), and the two assertions that had to be reworded (toMatchObjectforcanBeMalleable,sliceoverit.eachdata in place of a ternary) assert exactly the same values as before. No production code, lint configuration or test expectation changed.Changes
packages/bitcoin-wallet-snap/src/handlers/mappings.test.ts— helper return types (Transaction,TxOut,MockProxy<BitcoinAccount>),as any->as unknown as Addressfor theAddress.from_scriptmocks, and asset property reads narrowed to theAssetunion member shape (no-explicit-any,no-unsafe-return,no-unsafe-member-access,explicit-function-return-type)packages/bitcoin-wallet-snap/src/handlers/RpcHandler.test.ts— sameAddress/Balancetyping,mock<BitcoinAccount>({...})account fixtures, explicitto_satmock return types, four redundantas anyonparamsand four redundantas nevercasts dropped,canBeMalleableasserted withtoMatchObject(no-explicit-any,no-unnecessary-type-assertion,no-unsafe-argument,no-unsafe-return,no-unsafe-member-access,explicit-function-return-type)packages/bitcoin-wallet-snap/src/handlers/KeyringHandler.test.ts— generic renamed to satisfyid-length,expect.objectContainingcallbacks returnunknown,'p2tr' as AddressTypedropped,it.eachcarries the expected persisted-account count instead of a ternary, caught rejection typedError,to_btcmock typed (id-length,no-unsafe-return,no-unnecessary-type-assertion,vitest/no-conditional-in-test,explicit-function-return-type)packages/bitcoin-wallet-snap/src/handlers/CronHandler.test.ts— thesnap_getState/snap_setStatemock is a handler map instead of anif, with the JSON round-trip in a module-scoped,Json-typed helper (vitest/no-conditional-in-test,no-unsafe-return)packages/bitcoin-wallet-snap/src/handlers/UserInputHandler.test.ts— two redundantas UserInputEventassertions dropped along with the now-unused type import (no-unnecessary-type-assertion)packages/bitcoin-wallet-snap/src/handlers/HandlerMiddleware.test.ts— redundantas unknown as Mockdropped (no-unnecessary-type-assertion)packages/bitcoin-wallet-snap/src/handlers/validation.test.ts— return types on thefeeRateand account helpers (explicit-function-return-type)oxlint-suppressions.json— regenerated with--prune-suppressions(Bitcoin package 185 -> 102 violations; the remaining 102 entries are in sibling files owned by parallel cleanups)Quality gates
yarn lint:oxlint packages/bitcoin-wallet-snap— clean, 83 violations / 21 suppressions entries removed (my files: 83 -> 0)tsc --noEmit— cleanvitest run— 28 files / 761 tests pass (matches theorigin/mainbaseline)oxfmt --check— clean