Internal template choice
- Neelam_DwivediOP
I have a simple template with one choice and a script that creates a contract and exercises the choice. When I run daml test, it gives the summary shown below which says that there are two choices in the template. Is there a hidden choice somewhere? How can I test that choice to make test-coverage 100%
Test Summary daml/Main.daml:testBankService: ok, 1 active contracts, 2 transactions. Modules internal to this package: - Internal templates 1 defined 1 (100.0%) created - Internal template choices 2 defined 1 ( 50.0%) exercisedHere is the code:
module BankService where template BankAccount with bank: Party accountOwner: Party balance: Numeric 2 where signatory bank, accountOwner choice Deposit: ContractId BankAccount with amount: Numeric 2 controller accountOwner do create this with balance = balance + amountmodule Main where import Daml.Script import BankService testBankService : Script () testBankService = script do bank <- allocateParty "Bank" alice <- allocateParty "Alice" aliceAccountCid <- submitMulti [bank, alice][] do createCmd BankAccount with bank accountOwner = alice balance = 100.00 aliceAccountCid <- submit alice do exerciseCmd aliceAccountCid Deposit with amount = 20.00 return () - Mate_Varga
Hi @Neelam_Dwivedi,
Archive is a consoming choice which is implicitly defined for all templates. I’m not sure if a direct test is required for it, but that would be my guess here.
- Neelam_Dwivedi
Got it! Thanks @Mate_Varga !