difftreelog
fix enable test-pallet in tests
in: master
2 files changed
tests/src/eth/scheduling.test.tsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {expect} from 'chai';18import {EthUniqueHelper, itEth} from './util/playgrounds';19import {Pallets} from '../util/playgrounds';2021describe('Scheduing EVM smart contracts', () => {2223 itEth.ifWithPallets('Successfully schedules and periodically executes an EVM contract', [Pallets.Scheduler], async ({helper, privateKey}) => {24 const alice = privateKey('//Alice');2526 const scheduledId = await helper.arrange.makeScheduledId();2728 const deployer = await helper.eth.createAccountWithBalance(alice);29 const flipper = await helper.eth.deployFlipper(deployer);3031 const initialValue = await flipper.methods.getValue().call();32 await helper.eth.transferBalanceFromSubstrate(alice, helper.address.substrateToEth(alice.address));3334 const waitForBlocks = 4;35 const periodic = {36 period: 2,37 repetitions: 2,38 };3940 await helper.scheduler.scheduleAfter<EthUniqueHelper>(scheduledId, waitForBlocks, {periodic})41 .eth.sendEVM(42 alice,43 flipper.options.address,44 flipper.methods.flip().encodeABI(),45 '0',46 );4748 expect(await flipper.methods.getValue().call()).to.be.equal(initialValue);49 50 await helper.wait.newBlocks(waitForBlocks + 1);51 expect(await flipper.methods.getValue().call()).to.be.not.equal(initialValue);5253 await helper.wait.newBlocks(periodic.period);54 expect(await flipper.methods.getValue().call()).to.be.equal(initialValue);55 });56});1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {expect} from 'chai';18import {EthUniqueHelper, itEth} from './util/playgrounds';19import {Pallets, usingPlaygrounds} from '../util/playgrounds';2021describe('Scheduing EVM smart contracts', () => {2223 before(async () => {24 await usingPlaygrounds(async (helper) => {25 await helper.testUtils.enable();26 });27 });2829 itEth.ifWithPallets('Successfully schedules and periodically executes an EVM contract', [Pallets.Scheduler], async ({helper, privateKey}) => {30 const alice = privateKey('//Alice');3132 const scheduledId = await helper.arrange.makeScheduledId();3334 const deployer = await helper.eth.createAccountWithBalance(alice);35 const flipper = await helper.eth.deployFlipper(deployer);3637 const initialValue = await flipper.methods.getValue().call();38 await helper.eth.transferBalanceFromSubstrate(alice, helper.address.substrateToEth(alice.address));3940 const waitForBlocks = 4;41 const periodic = {42 period: 2,43 repetitions: 2,44 };4546 await helper.scheduler.scheduleAfter<EthUniqueHelper>(scheduledId, waitForBlocks, {periodic})47 .eth.sendEVM(48 alice,49 flipper.options.address,50 flipper.methods.flip().encodeABI(),51 '0',52 );5354 expect(await flipper.methods.getValue().call()).to.be.equal(initialValue);55 56 await helper.wait.newBlocks(waitForBlocks + 1);57 expect(await flipper.methods.getValue().call()).to.be.not.equal(initialValue);5859 await helper.wait.newBlocks(periodic.period);60 expect(await flipper.methods.getValue().call()).to.be.equal(initialValue);61 });62});tests/src/scheduler.test.tsdiffbeforeafterboth--- a/tests/src/scheduler.test.ts
+++ b/tests/src/scheduler.test.ts
@@ -24,10 +24,12 @@
let charlie: IKeyringPair;
before(async () => {
- await usingPlaygrounds(async (_, privateKeyWrapper) => {
+ await usingPlaygrounds(async (helper, privateKeyWrapper) => {
alice = privateKeyWrapper('//Alice');
bob = privateKeyWrapper('//Bob');
charlie = privateKeyWrapper('//Charlie');
+
+ await helper.testUtils.enable();
});
});
@@ -414,9 +416,11 @@
let bob: IKeyringPair;
before(async () => {
- await usingPlaygrounds(async (_, privateKeyWrapper) => {
+ await usingPlaygrounds(async (helper, privateKeyWrapper) => {
alice = privateKeyWrapper('//Alice');
bob = privateKeyWrapper('//Bob');
+
+ await helper.testUtils.enable();
});
});