Skip to content

test(models): Asset + Balance + Transaction (+14 tests)#350

Merged
TaprootFreak merged 1 commit into
developfrom
test/models
May 15, 2026
Merged

test(models): Asset + Balance + Transaction (+14 tests)#350
TaprootFreak merged 1 commit into
developfrom
test/models

Conversation

@TaprootFreak
Copy link
Copy Markdown
Contributor

Summary

Stage 26 of the coverage push. Pure-Dart model classes.

Model Cases
`Asset` 5
`Balance` 5
`Transaction` 3
`TransactionTypes` enum 1

What each model pins

  • Asset: `id` derived from `fastHash(chainId:address)`; `Asset.getId` static matches the instance getter; different chains / addresses produce different ids; `id` depends only on chain+address, not on metadata (`name` / `symbol` / `decimals` don't affect identity — important for repo de-duplication).
  • Balance: `id` from `fastHash(wallet:chain:contract)`; `balance` amount is mutable; two Balances with the same identity tuple are `==` regardless of amount (pinned so a stream-emitted update with a new amount can still match an existing map key); different chain / wallet differs.
  • Transaction: `isOutbound` true when sender matches wallet (EIP-55 normalised); false when sender differs; normalises hex-digit case via `fromHex` / `hexEip55` on both sides (NOT case-insensitive on the `0x` prefix — that breaks fromHex; the test pins the actual contract).
  • TransactionTypes: values has exactly 5 entries (catches an accidental addition that would silently break the rendering switch).

Test plan

  • `flutter analyze` clean
  • `flutter test` — 14 / 14 passing locally
  • CI green

Stage 26 of the coverage push. Pure-Dart model classes.

- Asset (5): id from fastHash(chainId:address); Asset.getId static
  matches the instance getter; different chains / addresses produce
  different ids; id depends only on chain+address, not on metadata
  (name/symbol/decimals don't affect identity)
- Balance (5): id from fastHash(wallet:chain:contract); balance
  amount is mutable; two Balances with the same identity tuple are
  == regardless of amount (pinned so a stream-emitted update with a
  new amount can still match an existing map key); different chain /
  wallet differs
- Transaction (3): isOutbound true when sender matches wallet
  (EIP-55 normalised); false when sender differs; normalises hex-
  digit case on both sides via fromHex/hexEip55
- TransactionTypes (1): values has exactly 5 entries (catches an
  accidental addition that would silently break the rendering switch)
@TaprootFreak TaprootFreak marked this pull request as ready for review May 15, 2026 17:24
@TaprootFreak TaprootFreak merged commit 6421ff4 into develop May 15, 2026
1 check passed
@TaprootFreak TaprootFreak deleted the test/models branch May 15, 2026 17:24
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