From 35058074c9df4d539f095b9bb5294ec56ed80541 Mon Sep 17 00:00:00 2001 From: Maksandre Date: Wed, 05 Oct 2022 12:00:09 +0000 Subject: [PATCH] Fix: eth sponsoring test --- --- a/tests/src/eth/sponsoring.test.ts +++ b/tests/src/eth/sponsoring.test.ts @@ -14,21 +14,27 @@ // You should have received a copy of the GNU General Public License // along with Unique Network. If not, see . -import {SponsoringMode} from './util/helpers'; -import {itEth, expect} from '../eth/util/playgrounds'; +import {IKeyringPair} from '@polkadot/types/types'; +import {itEth, expect, SponsoringMode} from '../eth/util/playgrounds'; +import {usingPlaygrounds} from './../util/playgrounds/index'; describe('EVM sponsoring', () => { - itEth('Fee is deducted from contract if sponsoring is enabled', async ({helper, privateKey}) => { - const alice = privateKey('//Alice'); + let donor: IKeyringPair; + + before(async () => { + await usingPlaygrounds(async (helper, privateKey) => { + donor = privateKey('//Alice'); + }); + }); - const owner = await helper.eth.createAccountWithBalance(alice); - const sponsor = await helper.eth.createAccountWithBalance(alice); - const caller = await helper.eth.createAccount(); + itEth('Fee is deducted from contract if sponsoring is enabled', async ({helper}) => { + const owner = await helper.eth.createAccountWithBalance(donor); + const sponsor = await helper.eth.createAccountWithBalance(donor); + const caller = helper.eth.createAccount(); const originalCallerBalance = await helper.balance.getEthereum(caller); expect(originalCallerBalance).to.be.equal(0n); - // const flipper = await deployFlipper(web3, owner); const flipper = await helper.eth.deployFlipper(owner); const helpers = helper.ethNativeContract.contractHelpers(owner); @@ -55,12 +61,10 @@ expect(await helper.balance.getEthereum(sponsor)).to.be.not.equal(originalSponsorBalance); }); - itEth('...but this doesn\'t applies to payable value', async ({helper, privateKey}) => { - const alice = privateKey('//Alice'); - - const owner = await helper.eth.createAccountWithBalance(alice); - const sponsor = await helper.eth.createAccountWithBalance(alice); - const caller = await helper.eth.createAccountWithBalance(alice); + itEth('...but this doesn\'t applies to payable value', async ({helper}) => { + const owner = await helper.eth.createAccountWithBalance(donor); + const sponsor = await helper.eth.createAccountWithBalance(donor); + const caller = await helper.eth.createAccountWithBalance(donor); const originalCallerBalance = await helper.balance.getEthereum(caller); expect(originalCallerBalance).to.be.not.equal(0n); -- gitstuff