From 5bf7ef40777d42b49643b6e04dcb279607cb7ff8 Mon Sep 17 00:00:00 2001 From: Daniel Shiposha Date: Fri, 24 Nov 2023 12:57:57 +0000 Subject: [PATCH] fix: reset sudo after elect sudo test --- --- a/js-packages/tests/sub/governance/electsudo.test.ts +++ b/js-packages/tests/sub/governance/electsudo.test.ts @@ -32,6 +32,19 @@ const [newAccount] = await helper.arrange.createAccounts([1000n], donor); const newSudoKey = newAccount.address; + // Have to use `afterEach` here instead of `after` to ensure it will be executed before `describe.after`. + afterEach(async () => { + // For some reason, the outer helper API is not initialized inside `afterEach`. + await usingPlaygrounds(async (helper) => { + await helper.executeExtrinsic( + newAccount, + 'api.tx.sudo.setKey', + [sudoer.address], + false, + ); + }); + }); + const democracyProposal = helper.constructApiCall('api.tx.utility.dispatchAs', [ { system: { @@ -82,7 +95,5 @@ const currentSudoKey = await helper.callRpc('api.query.sudo.key', []) .then(k => k.toString()); expect(currentSudoKey).to.be.equal(newSudoKey); - - await helper.executeExtrinsic(newAccount, 'api.tx.sudo.setKey', [sudoer.address]); }); }); -- gitstuff