Skip to content

test(packages): cover utils + wallet pure-Dart surface (+38 tests)#324

Merged
TaprootFreak merged 1 commit into
developfrom
test/utils-and-wallet-packages
May 15, 2026
Merged

test(packages): cover utils + wallet pure-Dart surface (+38 tests)#324
TaprootFreak merged 1 commit into
developfrom
test/utils-and-wallet-packages

Conversation

@TaprootFreak
Copy link
Copy Markdown
Contributor

Summary

Adds 38 unit tests across six previously-untested files in lib/packages/utils/ and lib/packages/wallet/. Each spec lives in the mirror path under test/ per the project convention.

File under test Test file Cases
lib/packages/utils/fast_hash.dart test/packages/utils/fast_hash_test.dart 5
lib/packages/utils/jwt_decoder.dart test/packages/utils/jwt_decoder_test.dart 7
lib/packages/wallet/payment_uri.dart test/packages/wallet/payment_uri_test.dart 4
lib/packages/wallet/wallet_account.dart test/packages/wallet/wallet_account_test.dart 7
lib/packages/wallet/wallet.dart test/packages/wallet/wallet_test.dart 11
lib/packages/wallet/eip7702_signer.dart test/packages/wallet/eip7702_signer_test.dart 4

What each file covers

  • fast_hash: FNV-1a determinism, distinct inputs differ, ordering matters, unicode safety, empty-string offset basis.
  • jwt_decoder: well-formed payload parsing, segment-count errors, non-map payload rejection, all three valid base64url padding lengths, illegal length-mod-4 rejection.
  • payment_uri: empty-amount short form, dotted and comma-locale amounts, preservation of decimal precision.
  • wallet_account: BIP-44 derivation path format, deterministic Hardhat account #0 address from the standard test mnemonic, distinct indices, signMessage shape + determinism + sensitivity to addressIndex.
  • wallet: SoftwareWallet walletType + primary/current account identity + selectAccount semantics + id/name mutability; DebugWallet sign refusal.
  • eip7702_signer: hardware-credential refusal (BitBox cannot sign EIP-7702), software-credential signing, signature determinism, nonce-sensitivity.

Why

Stage 2 of the coverage push tracked in the README features matrix (#322). These six files are pure-Dart with no platform dependencies, so they were the cheapest meaningful coverage win available — no service mocks, no widget rendering, no merge-conflict risk with the three in-flight test PRs (#319, #320, #321).

Test plan

  • flutter analyze clean on all six new test files (locally on Flutter 3.38.5)
  • flutter test test/packages/utils/ test/packages/wallet/ — 38 / 38 passing
  • CI green on this branch
  • Spot-check: coverage artifact from ci: measure test coverage and upload as artifact #323 (once that lands) shows non-zero coverage on the six files above

Adds 38 unit tests across six previously-untested files in
`lib/packages/utils/` and `lib/packages/wallet/`. Each spec lives in
the mirror path under `test/` per the project convention.

- fast_hash: FNV-1a determinism, distinct inputs differ, ordering matters,
  unicode safety, empty-string offset basis
- jwt_decoder: well-formed payload parsing, segment-count errors,
  non-map payload rejection, all three valid base64url padding lengths,
  illegal length-mod-4 rejection
- payment_uri: empty-amount short form, dotted and comma-locale amounts,
  preservation of decimal precision
- wallet_account: BIP-44 derivation path format, deterministic Hardhat
  account #0 address, distinct indices, signMessage shape +
  determinism + sensitivity to addressIndex
- wallet: SoftwareWallet walletType + primary/current account identity +
  selectAccount semantics + id/name mutability; DebugWallet sign refusal
- eip7702_signer: hardware-credential refusal, software-credential
  signing, signature determinism, nonce-sensitivity

No production code changed. All tests pass locally on Flutter 3.38.5
with the project's pinned web3dart fork.
@TaprootFreak TaprootFreak marked this pull request as ready for review May 15, 2026 07:21
@TaprootFreak TaprootFreak merged commit be9cc12 into develop May 15, 2026
1 check passed
@TaprootFreak TaprootFreak deleted the test/utils-and-wallet-packages branch May 15, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant