Export and reuse extractWitnessable* functions in tests#1125
Export and reuse extractWitnessable* functions in tests#1125
Conversation
cardano-api/test/cardano-api-test/Test/Cardano/Api/Transaction/Body/Plutus/Scripts.hs
Fixed
Show fixed
Hide fixed
Replace six inline list comprehensions in prop_extractAllIndexedPlutusScriptWitnesses with calls to the existing extractWitnessable* production helpers, which are now exported from New.hs and re-exported from Tx.hs.
c2aba71 to
17264b1
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors the prop_extractAllIndexedPlutusScriptWitnesses test by replacing inline list comprehensions with calls to the already-existing production extractWitnessable* functions, eliminating duplicated conversion logic between tests and production code.
Changes:
- Exports 6
extractWitnessable*functions (TxIns,Mints,Certificates,Withdrawals,Votes,Proposals) fromCardano.Api.Experimental.Tx.Internal.BodyContent.NewandCardano.Api.Experimental.Tx - Replaces inline list comprehensions in the test with calls to the newly-exported production functions, removing the now-unused
Data.Map.Orderedimport
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
cardano-api/src/Cardano/Api/Experimental/Tx/Internal/BodyContent/New.hs |
Adds 6 extractWitnessable* functions to the module's export list under "Internal conversions" |
cardano-api/src/Cardano/Api/Experimental/Tx.hs |
Re-exports the 6 extractWitnessable* functions under "Internal functions" |
cardano-api/test/cardano-api-test/Test/Cardano/Api/Transaction/Body/Plutus/Scripts.hs |
Replaces 6 inline list comprehensions with calls to the production extractWitnessable* functions and removes the unused OMap import |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| | let Exp.TxProposalProcedures pMap = generatedTxProposalProcedures | ||
| , (p, wit) <- OMap.toAscList pMap | ||
| ] | ||
| map (\(w, sw) -> (w, anyScriptWitnessToAnyWitness sw)) $ |
Check notice
Code scanning / HLint
Use second Note test
There was a problem hiding this comment.
@copilot how come it did not show up in the hlint github action?
- Apply fourmolu formatting to Scripts.hs (break long lines) - Remove ordered-containers from cardano-api-test build-depends (unused after replacing inline list comprehensions with direct calls to the exported extractWitnessable* functions)
18c3814 to
ee7d59f
Compare
|
@carbolymer I've opened a new pull request, #1127, to work on those changes. Once the pull request is ready, I'll request review from you. |
Changelog
Context
Closes #1083
How to trust this PR
comprehensions in
prop_extractAllIndexedPlutusScriptWitnessescabal test cardano-api-testand confirm the property test still passesChecklist