test: consolidate and enrich v2 calldata conversion tests - #321
Merged
Conversation
Enrich the v2 calldata conversion suite to cover all implemented field formats (raw, amount, duration, chainId, tokenTicker, addressName, tokenAmount, nftName, calldata, enum, date, unit) and consolidate the per-format files into a single parametrized module with an inline descriptor helper.
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.
Summary
Enriches the v2 calldata conversion test suite to cover all currently implemented display field formats, and consolidates the previously per-format test files into a single parametrized module to reduce boilerplate.
Previously only
chainIdandtokenTickerhad dedicated tests. This adds coverage for every implemented format and folds everything into one file with a small inline descriptor helper, so each case is expressed as just its minimal, format-specific part.What changed
tests/v2/convert/calldata/test_convert_fields.py:convert_field,assert_serializes_param_type) that build a minimal v2 descriptor from a single display field + signature, run the conversion, and assert the serializedPARAM_TYPETLV tag.test_convert_fieldcovering the homogeneous cases:raw,amount,duration,chainId,tokenTicker,addressName,tokenAmount,nftName,calldata,enum(one test id per format).date(timestamp vs blockheight encodings),unitparams,tokenTickernative_currencies is None, andtokenAmounttoken-path resolution.test_convert_chain_id.pyandtest_convert_token_ticker.py(superseded by the consolidated module).Notes
format) in JSON mode, so the helper validates viamodel_validate_json.addressNamerequiresparamsto resolve, so its case includes{"types": ["contract"]}.Validation
ruffandmypypre-commit hooks pass.