git.delta.rocks / unique-network / refs/commits / 35058074c9df

difftreelog

fix eth sponsoring test

Maksandre2022-10-05parent: #25d2901.patch.diff
in: master

1 file changed

modifiedtests/src/eth/sponsoring.test.tsdiffbeforeafterboth
14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
1616
17import {SponsoringMode} from './util/helpers';17import {IKeyringPair} from '@polkadot/types/types';
18import {itEth, expect} from '../eth/util/playgrounds';18import {itEth, expect, SponsoringMode} from '../eth/util/playgrounds';
19import {usingPlaygrounds} from './../util/playgrounds/index';
1920
20describe('EVM sponsoring', () => {21describe('EVM sponsoring', () => {
22 let donor: IKeyringPair;
23
24 before(async () => {
25 await usingPlaygrounds(async (helper, privateKey) => {
26 donor = privateKey('//Alice');
27 });
28 });
29
21 itEth('Fee is deducted from contract if sponsoring is enabled', async ({helper, privateKey}) => {30 itEth('Fee is deducted from contract if sponsoring is enabled', async ({helper}) => {
22 const alice = privateKey('//Alice');
23
24 const owner = await helper.eth.createAccountWithBalance(alice);31 const owner = await helper.eth.createAccountWithBalance(donor);
25 const sponsor = await helper.eth.createAccountWithBalance(alice);32 const sponsor = await helper.eth.createAccountWithBalance(donor);
26 const caller = await helper.eth.createAccount();33 const caller = helper.eth.createAccount();
27 const originalCallerBalance = await helper.balance.getEthereum(caller);34 const originalCallerBalance = await helper.balance.getEthereum(caller);
2835
29 expect(originalCallerBalance).to.be.equal(0n);36 expect(originalCallerBalance).to.be.equal(0n);
3037
31 // const flipper = await deployFlipper(web3, owner);
32 const flipper = await helper.eth.deployFlipper(owner);38 const flipper = await helper.eth.deployFlipper(owner);
3339
34 const helpers = helper.ethNativeContract.contractHelpers(owner);40 const helpers = helper.ethNativeContract.contractHelpers(owner);
55 expect(await helper.balance.getEthereum(sponsor)).to.be.not.equal(originalSponsorBalance);61 expect(await helper.balance.getEthereum(sponsor)).to.be.not.equal(originalSponsorBalance);
56 });62 });
5763
58 itEth('...but this doesn\'t applies to payable value', async ({helper, privateKey}) => {64 itEth('...but this doesn\'t applies to payable value', async ({helper}) => {
59 const alice = privateKey('//Alice');
60
61 const owner = await helper.eth.createAccountWithBalance(alice);65 const owner = await helper.eth.createAccountWithBalance(donor);
62 const sponsor = await helper.eth.createAccountWithBalance(alice);66 const sponsor = await helper.eth.createAccountWithBalance(donor);
63 const caller = await helper.eth.createAccountWithBalance(alice);67 const caller = await helper.eth.createAccountWithBalance(donor);
64 const originalCallerBalance = await helper.balance.getEthereum(caller);68 const originalCallerBalance = await helper.balance.getEthereum(caller);
6569
66 expect(originalCallerBalance).to.be.not.equal(0n);70 expect(originalCallerBalance).to.be.not.equal(0n);