Testing Contract Archived

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!

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)
1 Like

That works, thank you!