test(api): add TxOut JSON tests and document case* deprecation#1040
Open
test(api): add TxOut JSON tests and document case* deprecation#1040
Conversation
55e5a9d to
1eafdd8
Compare
Jimbo4350
requested changes
Nov 27, 2025
Jimbo4350
requested changes
Nov 27, 2025
| ] | ||
|
|
||
| -- | Generate a TxOut for a specific era (using appropriate datum types) | ||
| genTxOutForEra |
Contributor
There was a problem hiding this comment.
Where is this being consumed? This function is promoting the propagation of the eon based types we are trying to get rid of e.g AlonzoEraOnwardsAlonzo etc.
Collaborator
Author
There was a problem hiding this comment.
It's not used. Missed this one when simplifying tests. I have removed it.
3 tasks
1eafdd8 to
f90e9af
Compare
f90e9af to
bbdeb99
Compare
Implements extensive test coverage for the ToJSON and FromJSON instances of TxOut, adapted for the new Exp.IsEra constraint on ToJSON. Test modules added: - Test.Gen.Cardano.Api.TxOut: Specialized generators for TxOut with specific datum types (no datum, datum hash, supplemental, inline) and invalid JSON scenarios for error testing - Test.Cardano.Api.TxOut.Helpers: Test utilities including JSON field assertions, parse failure validators, and datum equality checks - Test.Cardano.Api.TxOut.Json: Main test module organizing all test suites - Test.Cardano.Api.TxOut.JsonRoundtrip: Roundtrip property tests for Conway era in both CtxTx and CtxUTxO contexts - Test.Cardano.Api.TxOut.JsonEdgeCases: Edge case tests for supplemental datum behavior, null field handling, and ToJSON output validation - Test.Cardano.Api.TxOut.JsonErrorCases: Error case tests for conflicting datums, mismatched hashes, partial fields, and invalid data Note: Tests are limited to Conway era because: - ToJSON now uses Exp.IsEra constraint (Conway/Dijkstra only) - Dijkstra era is not yet fully supported by shelleyBasedEraConstraints
bbdeb99 to
db7c007
Compare
|
This PR is stale because it has been open 45 days with no activity. |
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
This PR adds comprehensive test coverage for the TxOut JSON instances and documents the deprecation of era case* functions.
Changes
1. Deprecation Notice for Era Case Functions
Adds documentation to
Cardano.Api.Era.Internal.Casenoting thatcase*functions are deprecated and will be removed in a future release. New code should use direct pattern matching on era witnesses instead.2. Comprehensive TxOut JSON Tests
Implements extensive test coverage for the
ToJSONandFromJSONinstances ofTxOut, adapted for theExp.IsEraconstraint onToJSON.New test modules:
Test.Gen.Cardano.Api.TxOut: Specialized generators for TxOut with specific datum types (no datum, datum hash, supplemental, inline) and invalid JSON scenariosTest.Cardano.Api.TxOut.Helpers: Test utilities including JSON field assertions, parse failure validators, and datum equality checksTest.Cardano.Api.TxOut.Json: Main test module organizing all test suitesTest.Cardano.Api.TxOut.JsonRoundtrip: Roundtrip property tests for Conway era (CtxTx and CtxUTxO)Test.Cardano.Api.TxOut.JsonEdgeCases: Edge case tests for supplemental datum behavior, null field handling, ToJSON output validationTest.Cardano.Api.TxOut.JsonErrorCases: Error case tests for conflicting datums, mismatched hashes, partial fields, invalid dataNote: Tests are limited to Conway era because:
ToJSONnow usesExp.IsEraconstraint (Conway/Dijkstra only)shelleyBasedEraConstraintsTest Coverage
Changelog
Checklist