errors.spec.ts 692 B

123456789101112131415161718192021222324
  1. import expect from 'expect';
  2. import { establishConnection } from './index';
  3. describe('Deploy solang contract and test', () => {
  4. it('errors', async function () {
  5. this.timeout(50000);
  6. let conn = await establishConnection();
  7. let errors = await conn.loadProgram("bundle.so", "errors.abi");
  8. // call the constructor
  9. await errors.call_constructor(conn, 'errors', []);
  10. let res = await errors.call_function(conn, "do_revert", [false]);
  11. expect(res["0"]).toBe("3124445");
  12. let revert_res = await errors.call_function_expect_revert(conn, "do_revert", [true]);
  13. expect(revert_res).toBe("Do the revert thing");
  14. });
  15. });