difftreelog
test(CollatorSelection) added restoration of invulnerables
in: master
1 file changed
tests/src/shuffleCollators.test.tsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// 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/>.161617import {ApiPromise} from '@polkadot/api';18import {IKeyringPair} from '@polkadot/types/types';17import {IKeyringPair} from '@polkadot/types/types';19import privateKey from './substrate/privateKey';18import privateKey from './substrate/privateKey';20import usingApi, { submitTransactionAsync } from './substrate/substrate-api';19import usingApi, { submitTransactionAsync } from './substrate/substrate-api';21import waitNewBlocks from './substrate/wait-new-blocks';20import waitNewBlocks from './substrate/wait-new-blocks';22import {expect} from 'chai';21import {expect} from 'chai';23import { getGenericResult } from './util/helpers';22import { getGenericResult } from './util/helpers';24//import find from 'find-process';252326let alice: IKeyringPair;24let alice: IKeyringPair;27let bob: IKeyringPair;25let bob: IKeyringPair;28let charlie: IKeyringPair;26let charlie: IKeyringPair;29let dave: IKeyringPair;27let dave: IKeyringPair;30let eve: IKeyringPair;28let eve: IKeyringPair;3132const alice_port = 31200;33const bob_port = 31201;342935describe('Integration Test: Dynamic shuffling of collators', () => {30describe('Integration Test: Dynamic shuffling of collators', () => {36 before(async () => { 31 before(async () => { 86 expect(newValidators).to.contain(charlie.address).and.contain(dave.address);81 expect(newValidators).to.contain(charlie.address).and.contain(dave.address);87 expect(newValidators).to.be.length(2);82 expect(newValidators).to.be.length(2);8384 // todo add delay to check that new blocks are authored by these88 });85 });89 });86 });8788 after(async () => {89 await usingApi(async (api) => {90 const tx = api.tx.collatorSelection.setInvulnerables([91 alice.address,92 bob.address93 ]);94 const sudoTx = api.tx.sudo.sudo(tx as any);95 const events = await submitTransactionAsync(alice, sudoTx);96 const result = getGenericResult(events);97 expect(result.success).to.be.true;98 });99 });90});100});101