test(format): Add unit tests for XLM amount formatter (#39) - #44
Merged
Chucks1093 merged 1 commit intoJul 30, 2026
Merged
Conversation
|
@abdulqoyumadegoke 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! 🚀 |
abdulqoyumadegoke
force-pushed
the
test/39-xlm-amount-formatter-tests
branch
from
July 30, 2026 05:57
4ea5cb5 to
b274d94
Compare
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.
Closes #39
Overview
Resolves #39 by adding a standardized
formatXLMamount formatting utility function (lib/format.ts) and unit test suite (lib/__tests__/formatXLM.test.ts) that guarantees correct thousand separators, two fixed decimal places, and accurate handling of zero, fractional, and negative XLM values without floating-point representation errors.Key Changes
lib/format.ts: ImplementedformatXLMutility handlingnumber | string | bigintinputs, appending trailingXLMsuffixes withen-USthousand separators (1,000,000.00 XLM) and fallback safety.lib/portfolio.ts: Updated portfolio summary total calculation to useformatXLM.lib/__tests__/formatXLM.test.ts:10000->'10,000.00 XLM'.0->'0.00 XLM'.0.5->'0.50 XLM'.1000000->'1,000,000.00 XLM'.-500) ->'-500.00 XLM'.0.1 + 0.2->'0.30 XLM',1234.5678->'1,234.57 XLM').Verification