Add comprehensive Jest unit tests for cryptoformat module#76
Merged
Conversation
Contributor
Author
Original prompt from cedric@coingecko.com |
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
jasonjul
reviewed
Aug 27, 2025
- Add extensive test coverage for internal helper functions (isBTCETH, IntlNumberFormatSupported) - Add edge case testing for invalid inputs (null, undefined, NaN, Infinity) - Add boundary value testing for crypto and fiat currency thresholds - Add locale-specific edge case testing - Add caching mechanism verification tests - Add symbol override functionality tests - Add decimal trailing zeroes functionality tests - Add complex parameter combination tests - Add fallback formatter behavior tests - All 72 tests pass, providing comprehensive coverage of happy paths and edge cases Co-Authored-By: cedric@coingecko.com <cedric@coingecko.com>
8481b4a to
ebb3d4d
Compare
jasonjul
approved these changes
Aug 28, 2025
Collaborator
jasonjul
left a comment
There was a problem hiding this comment.
Approved, Devin's work
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.
Add comprehensive Jest unit tests for cryptoformat module (rebased for Jest v30)
Summary
This PR adds 317 lines of comprehensive Jest unit tests to
src/test.js, expanding test coverage from basic functionality to extensive edge cases, error conditions, and boundary testing for all exported functions (formatCurrency,isCrypto,clearCache) and internal helper functions.The PR has been rebased from master to include the Jest v30.1.1 upgrade (previously v24.9.0). All 72 tests pass with the new Jest version.
Key test additions:
isBTCETH,IntlNumberFormatSupported, fallback behaviorclearCache()works and formatters are reused appropriatelyIntl.NumberFormatis unavailableReview & Testing Checklist for Human
global.Intl- ensure this doesn't cause issues in your test environmentNotes