test: add comprehensive unit tests for formatting utilities and updat… - #276
Open
Unclebaffa wants to merge 1 commit into
Open
test: add comprehensive unit tests for formatting utilities and updat…#276Unclebaffa wants to merge 1 commit into
Unclebaffa wants to merge 1 commit into
Conversation
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.
📝 Comprehensive Summary of Implementation
1. Formatting Utilities Unit Test Suite (format.test.js)
Expanded unit test coverage from 3 basic functions to 26 unit tests covering all 7 functions exported by
src/utils/format.js:formatAmount:en-USformatting ($1,234.50).fr-FRdecimal/grouping separators,en-GBpound symbol placement).$0.00for non-numeric amounts ('not-a-number').'100.5'->$100.50).formatDate:en-USdate formatting (Jul 15, 2026).15 juil. 2026forfr-FR).'-') fornull,undefined, or empty string''.formatRate:1 USD = 294.6200 NGN).'-') fornullorundefinedrates.formatCurrencyInput:'') fornull,undefined, empty string'', or single period'.'.'1,234.5'->'1234.50','$100.5'->'100.50').'') for non-numeric input strings ('abc').formatPercent:0.005->'0.50%').formatPercent(0.005, 1)->'0.5%').'0.00%'for invalid/missing inputs.formatNumber:en-USgrouping (1,234.5).fr-FR).'0'for non-numeric inputs.shortenAddress:GBQAZ7...CDEF).headandtaillengths (shortenAddress(address, 4, 3)->GBQA...DEF).head + tail.'-') for empty,null, orundefinedinputs.2. Documentation Updates (README.md)
README.md.3. Code Quality & Verification
test/unit/format.test.jspassed (and 144/144 tests passed across the complete test suite).npm run lint): 0 errors, 0 warnings.npm run format:check): 100% code style compliant.Closes #9