queryContractId
doesn’t test for divulgence. It only returns the contract if you’re a stakeholder.
There is no super straightforward way to test this but you can try fetching it. See Assert for divulgence in a script - #2 by cocreature for an example.