From 5a5b604b91f3063fe80c87d68b9c2052b2360895 Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Tue, 02 Feb 2021 11:05:53 +0000 Subject: [PATCH] tests: toggleFlipValue contract helper --- --- a/tests/src/util/contracthelpers.ts +++ b/tests/src/util/contracthelpers.ts @@ -14,7 +14,7 @@ chai.use(chaiAsPromised); const expect = chai.expect; import { BigNumber } from 'bignumber.js'; -import { findUnusedAddress } from '../util/helpers'; +import { findUnusedAddress, getGenericResult } from '../util/helpers'; const value = 0; const gasLimit = '200000000000'; @@ -92,6 +92,14 @@ return (result.result.asOk.data[0] == 0x00) ? false : true; } +export async function toggleFlipValueExpectSuccess(sender: IKeyringPair, contract: Contract) { + const tx = contract.tx.flip(value, gasLimit); + const events = await submitTransactionAsync(sender, tx); + const result = getGenericResult(events); + + expect(result.success).to.be.true; +} + function instantiateTransferContract(alice: IKeyringPair, blueprint: Blueprint) : Promise { return new Promise(async (resolve, reject) => { const unsub = await blueprint.tx -- gitstuff