-
Notifications
You must be signed in to change notification settings - Fork 26
test(api): add TxOut JSON tests and document case* deprecation #1040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
55e5a9d to
1eafdd8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking until I have time to review. Hopefully be EOD today.
| ] | ||
|
|
||
| -- | Generate a TxOut for a specific era (using appropriate datum types) | ||
| genTxOutForEra |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not used. Missed this one when simplifying tests. I have removed it.
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
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