git.delta.rocks / unique-network / refs/commits / a6f62bd7dbe5

difftreelog

source

tests/src/collision-tests/adminDestroyCollection.test.ts1.9 KiBsourcehistory
1/* broken by design2// substrate transactions are sequential, not parallel3// the order of execution is indeterminate45import { IKeyringPair } from '@polkadot/types/types';6import chai from 'chai';7import chaiAsPromised from 'chai-as-promised';8import privateKey from '../substrate/privateKey';9import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';10import {11  createCollectionExpectSuccess,12  normalizeAccountId,13  waitNewBlocks,14} from '../util/helpers';1516chai.use(chaiAsPromised);17const expect = chai.expect;18let Alice: IKeyringPair;19let Bob: IKeyringPair;20let Ferdie: IKeyringPair;2122before(async () => {23  await usingApi(async () => {24    Alice = privateKey('//Alice');25    Bob = privateKey('//Bob');26    Ferdie = privateKey('//Ferdie');27  });28});2930describe('Deleting a collection while add address to allowlist: ', () => {31  // tslint:disable-next-line: max-line-length32  it('Adding an address to the collection allowlist in a block by the admin, and deleting the collection by the owner ', async () => {33    await usingApi(async (api) => {34      const collectionId = await createCollectionExpectSuccess();35      const changeAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));36      await submitTransactionAsync(Alice, changeAdminTx);37      await waitNewBlocks(1);38      //39      const addAllowlistAdm = api.tx.unique.addToAllowList(collectionId, normalizeAccountId(Ferdie.address));40      const destroyCollection = api.tx.unique.destroyCollection(collectionId);41      await Promise.all([42        addAllowlistAdm.signAndSend(Bob),43        destroyCollection.signAndSend(Alice),44      ]);45      await waitNewBlocks(1);46      let allowList = false;47      allowList = (await api.query.unique.allowList(collectionId, Ferdie.address)).toJSON() as boolean;48      // tslint:disable-next-line: no-unused-expression49      expect(allowList).to.be.false;50      await waitNewBlocks(2);51    });52  });53});54*/