git.delta.rocks / unique-network / refs/commits / 1fe40658030c

difftreelog

source

tests/src/collision-tests/adminRightsOff.test.ts2.1 KiBsourcehistory
1/* broken by design2// substrate transactions are sequential, not parallel3// the order of execution is indeterminate45import { IKeyringPair } from '@polkadot/types/types';6import BN from 'bn.js';7import chai from 'chai';8import chaiAsPromised from 'chai-as-promised';9import privateKey from '../substrate/privateKey';10import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';11import {12  createCollectionExpectSuccess,13  normalizeAccountId,14  waitNewBlocks,15} from '../util/helpers';1617chai.use(chaiAsPromised);18const expect = chai.expect;19let Alice: IKeyringPair;20let Bob: IKeyringPair;2122before(async () => {23  await usingApi(async () => {24    Alice = privateKey('//Alice');25    Bob = privateKey('//Bob');26  });27});2829describe('Deprivation of admin rights: ', () => {30  // tslint:disable-next-line: max-line-length31  it('In the block, the collection admin adds a token or changes data, and the collection owner deprives the admin of rights ', async () => {32    await usingApi(async (api) => {33      const collectionId = await createCollectionExpectSuccess();34      const changeAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));35      await submitTransactionAsync(Alice, changeAdminTx);36      await waitNewBlocks(1);37      const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];38      const addItemAdm = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(Bob.address), args);39      const removeAdm = api.tx.unique.removeCollectionAdmin(collectionId, normalizeAccountId(Bob.address));40      await Promise.all([41        addItemAdm.signAndSend(Bob),42        removeAdm.signAndSend(Alice),43      ]);44      await waitNewBlocks(2);45      const itemsListIndex = await api.query.unique.itemListIndex(collectionId) as unknown as BN;46      expect(itemsListIndex.toNumber()).to.be.equal(0);47      const adminList: any = (await api.query.unique.adminList(collectionId));48      expect(adminList).not.to.be.contains(normalizeAccountId(Bob.address));49      await waitNewBlocks(2);50    });51  });52});53*/