release_version.spec.ts 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. // SPDX-License-Identifier: Apache-2.0
  2. import { createConnection, deploy, aliceKeypair, debug_buffer } from "./index";
  3. import expect from 'expect';
  4. import { ContractPromise } from "@polkadot/api-contract";
  5. describe('Deploy release_version.sol and test the debug buffer is empty', () => {
  6. it('removes all debugging', async function () {
  7. let conn = await createConnection();
  8. const alice = aliceKeypair();
  9. let deployed_contract = await deploy(
  10. conn,
  11. alice,
  12. "release.contract",
  13. BigInt(0)
  14. );
  15. let contract = new ContractPromise(
  16. conn,
  17. deployed_contract.abi,
  18. deployed_contract.address
  19. );
  20. // The --release flag should remove all debugging features, making the debug buffer empty
  21. let res = await debug_buffer(conn, contract, `print_then_error`, [20])
  22. expect(res).not.toContain("Hello!")
  23. let res2 = await debug_buffer(conn, contract, `print_then_error`, [0])
  24. expect(res).not.toContain("Hello!")
  25. conn.disconnect();
  26. });
  27. });