Skip to content

feat: integration tests for useWalletBalance hook and unit tests for property similarity scorer, address formatter, and price formatter - #1532

Merged
nanaf6203-bit merged 1 commit into
MettaChain:mainfrom
Mai-Fura:feat/mai-wallet-balance-tests-and-formatters
Nov 24, 2026
Merged

nanaf6203-bit merged 1 commit into
MettaChain:mainfrom
Mai-Fura:feat/mai-wallet-balance-tests-and-formatters

Conversation

@Mai-Fura

Copy link
Copy Markdown
Contributor

Summary

Resolves all issues assigned to @Mai-Fura.

Changes

  • ui-extensions/tests/useWalletBalance.test.tsx — Integration tests for WalletBalanceCard (which wraps the useBalance / useAccount wagmi hooks). Covers: balance fetching for a connected wallet, multi-chain balance aggregation across Ethereum / Polygon / BSC, loading state (isFetching), missing-data error state (- dash), manual refresh button (disable + re-enable timing), and disconnect/cleanup state (prompt shown when not connected). wagmi hooks are fully mocked.

  • ui-extensions/tests/propertySimilarityScorer.test.ts — Unit tests for similarity and mostSimilar in propertyMath.ts. Covers identical properties (score = 1.0), completely different properties (score ≈ 0), partial match, Jaccard amenity scoring, missing fields, custom weight overrides, and descending-sort guarantee in mostSimilar.

  • ui-extensions/tests/blockchainAddressFormatter.test.ts — Unit tests for formatAddress in formatters.ts. Covers standard truncation (default prefix/suffix), custom prefix/suffix lengths, the no-truncation guard, invalid addresses (too short, missing 0x, non-hex chars, wrong length), checksum vs lowercase preservation, and null/undefined/number inputs.

  • ui-extensions/tests/propertyPriceFormatter.test.ts — Unit tests for formatPrice in formatters.ts. Covers USD, EUR, JPY (zero decimals), K/M/B compact abbreviation, zero and negative values (including -0), Arabic/RTL locale, and edge inputs (Infinity, NaN, MAX_SAFE_INTEGER). 100% branch coverage of formatPrice.

All changes are confined to ui-extensions/ as required by the isolation statement in each issue.

Closes

Closes #1453
Closes #1450
Closes #1447
Closes #1446

…property similarity scorer, address formatter, and price formatter

Closes MettaChain#1453
Closes MettaChain#1450
Closes MettaChain#1447
Closes MettaChain#1446
@drips-wave

drips-wave Bot commented Nov 23, 2026

Copy link
Copy Markdown

@Mai-Fura Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@nanaf6203-bit nanaf6203-bit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me — thanks for putting this together!

@nanaf6203-bit
nanaf6203-bit merged commit ef86854 into MettaChain:main Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants