Skip to content

test: asset_logo + Blockchain + xfile_extension (+22 tests)#349

Merged
TaprootFreak merged 1 commit into
developfrom
test/asset-logo-blockchain-xfile
May 15, 2026
Merged

test: asset_logo + Blockchain + xfile_extension (+22 tests)#349
TaprootFreak merged 1 commit into
developfrom
test/asset-logo-blockchain-xfile

Conversation

@TaprootFreak
Copy link
Copy Markdown
Contributor

Summary

Stage 25 of the coverage push. Three small pure-Dart targets.

File Cases
`lib/packages/utils/asset_logo.dart` 7
`lib/models/blockchain.dart` 8
`lib/packages/utils/xfile_extension.dart` 7

What each file pins

  • asset_logo: mainnet ETH (`chainId:1 + 0x0`) → `ETH.png`; mainnet RealUnit + Sepolia RealUnit → `REALU.png`; mixed-case address still resolves REALU (production lowercases first); unknown chain/address falls back to `REALU.png` (pinned — changing this would silently render every unknown asset as ETH instead). `getChainImagePath` for mainnet + Sepolia.
  • Blockchain: `Blockchain.values` has exactly 2 entries; chainId / name / nativeSymbol for both; `getFromChainId` resolves the known ids and throws `StateError` on unknown; `nativeAsset` shape (address `0x0`, decimals 18).
  • xfile_extension: `toBase64DataUri` uses an explicit `mimeType` when present; falls back to extension-based guessing for `.png` / `.jpg` / `.JPEG` (case-insensitive) / `.pdf`; defaults to `application/octet-stream` for unknown extensions; the base64 segment encodes the raw file bytes (verified by round-tripping a UTF-8 payload).

Notes

  • `xfile_extension` tests write a real `XFile` against a per-test temp directory so the production code's `readAsBytes` path runs unchanged. No platform-channel plumbing needed.

Test plan

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

Stage 25 of the coverage push.

- asset_logo (7): mainnet ETH → ETH.png; mainnet REALU → REALU.png;
  Sepolia REALU → REALU.png; mixed-case address still matches REALU
  (production code lowercases); unknown chain/address falls back to
  REALU (pinned — default branch); getChainImagePath for mainnet +
  Sepolia
- Blockchain (8): values is exactly {ethereum, sepolia}; chainId /
  name / nativeSymbol triples for both; getFromChainId resolves
  known ids; throws StateError for unknown; nativeAsset shape for
  both
- xfile_extension (7): explicit mimeType passthrough; .png /
  .jpg / .JPEG / .pdf guess; unknown extension falls back to
  octet-stream; base64 segment encodes raw bytes
@TaprootFreak TaprootFreak marked this pull request as ready for review May 15, 2026 13:11
@TaprootFreak TaprootFreak merged commit f49f155 into develop May 15, 2026
1 check passed
@TaprootFreak TaprootFreak deleted the test/asset-logo-blockchain-xfile branch May 15, 2026 13:11
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