--- 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