test(internal): add comprehensive tests and improve documentation#2601
Open
Dark-Brain07 wants to merge 5 commits intocoinbase:mainfrom
Open
test(internal): add comprehensive tests and improve documentation#2601Dark-Brain07 wants to merge 5 commits intocoinbase:mainfrom
Dark-Brain07 wants to merge 5 commits intocoinbase:mainfrom
Conversation
🟡 Heimdall Review Status
|
|
Someone is attempting to deploy a commit to the Coinbase Team on Vercel. A member of the Team first needs to authorize it. |
5a32250 to
debca35
Compare
- Add INTERNAL_ERROR_CODE and SERVER_ERROR_CODE constants - Handle -32603 (internal error) and -32000 (server error) codes - Add JSDoc documentation for getSwapErrorCode function - Reorganize and expand test coverage with better structure
- Add tests for very small positive and negative numbers - Add tests for very large percentage values - Add tests for special values (Infinity, -Infinity, NaN) - Add tests for high precision decimal places - Add tests for rounding behavior - Reorganize tests into logical describe blocks
debca35 to
1986270
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.
What changed? Why?
This PR improves test coverage and documentation across the OnchainKit codebase:
Added tests for isApiError utility - This internal utility was previously untested. Added comprehensive test suite covering valid API error responses, edge cases (null, undefined, empty objects), and non-error types. Also added JSDoc documentation with usage examples.
Added tests for prefixStringParts utility - Added missing test coverage for this string manipulation utility, including tests for basic prefixing, whitespace handling, edge cases, and CSS class name patterns.
Enhanced getSwapErrorCode with additional JSON-RPC error codes - Addressed the TODO comment by adding support for
-32603(Internal JSON-RPC error) and-32000(Server error). AddedINTERNAL_ERROR_CODEandSERVER_ERROR_CODEconstants with comprehensive JSDoc documentation.Improved JSDoc documentation for core utilities - Enhanced isBase and isEthereum functions with proper
@param,@returns, and@exampletags to improve developer experience.Added edge case tests for formatPercent utility - Expanded test coverage to include very small numbers, very large values, special values (Infinity, -Infinity, NaN), high precision decimal places, and rounding behavior verification.
Notes to reviewers
describeblocks for better readabilityHow has it been tested?
pnpm f:ock testto verify all tests passpnpm f:ock lintandpnpm f:ock typecheckto verify code quality