Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/Testing Contract ArchivedForum ↗

Testing Contract Archived

App Development3 posts239 views1 likesLast activity Jun 2022
SU
sungroaOP
Jun 2022

Hello all, I was having difficulty finding documentation for this and I wasn’t sure how to go about it. How do we test that a given contract is archived? I kinda hack it by trying submitMustFail with a choice in the contract, but that is not a desired solution since I don’t want it to pass just because that function changes behavior and the contract doesn’t actually get archived. Thank you!

BE
bernhard
Jun 2022

Hi @sungroa , I would use the queryContractId function in script:

do
  ...
  cid <- somethingThatCreatesAContractWithStakeholder p
  ...
  -- Check that the contract still exists
  args <- queryContractId p cid
  assertMsg (show cid <> " should be active") (isSome args)
  ...
  somethingThatArchives cid
  ...
  -- Check that the contract no longer exists
  args <- queryContractId p cid
  assertMsg (show cid <> " should be inactive") (isNone args)
SU
sungroa
Jun 2022

That works, thank you!

← Back to Discussions