debug_buffer_format.spec.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  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 debug_buffer_format.sol and test the debug buffer formatting', () => {
  6. it('formats the debug buffer', async function () {
  7. let conn = await createConnection();
  8. const alice = aliceKeypair();
  9. let deployed_contract = await deploy(
  10. conn,
  11. alice,
  12. "DebugBuffer.contract",
  13. BigInt(0)
  14. );
  15. let contract = new ContractPromise(
  16. conn,
  17. deployed_contract.abi,
  18. deployed_contract.address
  19. );
  20. let res = await debug_buffer(conn, contract, "multiple_prints", [])
  21. expect(res).toContain(`print: Hello!,`);
  22. expect(res).toContain(`print: I call seal_debug_message under the hood!,`);
  23. let res1 = await debug_buffer(conn, contract, "multiple_prints_then_revert", [])
  24. expect(res1).toContain(`print: Hello!,`);
  25. expect(res1).toContain(`print: I call seal_debug_message under the hood!,`);
  26. conn.disconnect();
  27. });
  28. });