difftreelog
test scheduled tx should take a fee
in: master
2 files changed
test-pallets/utils/src/lib.rsdiffbeforeafterboth--- a/test-pallets/utils/src/lib.rs
+++ b/test-pallets/utils/src/lib.rs
@@ -69,5 +69,10 @@
Err(<Error<T>>::TriggerRollback.into())
}
+
+ #[pallet::weight(100_000_000)]
+ pub fn just_take_fee(_origin: OriginFor<T>) -> DispatchResult {
+ Ok(())
+ }
}
}
tests/src/.outdated/scheduler.test.tsdiffbeforeafterboth216 });216 });217 });217 });218219 it('Scheduled tasks should take some fees', async function() {220 await requirePallets(this, [Pallets.TestUtils]);221222 await usingApi(async api => {223 const scheduledId = makeScheduledId();224 const waitForBlocks = 10;225 const period = 2;226 const repetitions = 1;227228 const dummyTxFeeAmount = 100_000_000;229230 const dummyTx = api.tx.testUtils.justTakeFee();231232 await expect(scheduleAfter(233 api,234 dummyTx,235 alice,236 waitForBlocks,237 scheduledId,238 period,239 repetitions,240 )).to.not.be.rejected;241242 const aliceInitBalance = await getFreeBalance(alice);243 let diff;244245 await waitNewBlocks(waitForBlocks + 1);246247 const aliceBalanceAfterFirst = await getFreeBalance(alice);248 expect(249 aliceBalanceAfterFirst < aliceInitBalance,250 '[after execution #1] Scheduled task should take a fee',251 ).to.be.true;252253 diff = aliceInitBalance - aliceBalanceAfterFirst;254 expect(diff).to.be.equal(dummyTxFeeAmount, 'Scheduled task should take the right amount of fees');255256 await waitNewBlocks(period);257258 const aliceBalanceAfterSecond = await getFreeBalance(alice);259 expect(260 aliceBalanceAfterSecond < aliceBalanceAfterFirst,261 '[after execution #2] Scheduled task should take a fee',262 ).to.be.true;263264 diff = aliceBalanceAfterFirst - aliceBalanceAfterSecond;265 expect(diff).to.be.equal(dummyTxFeeAmount, 'Scheduled task should take the right amount of fees');266 });267 });218268219 // FIXME What purpose of this test?269 // FIXME What purpose of this test?220 it.skip('Can schedule a scheduled operation of canceling the scheduled operation', async () => {270 it.skip('Can schedule a scheduled operation of canceling the scheduled operation', async () => {