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

difftreelog

source

tests/src/collision-tests/admVsOwnerTake.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  createItemExpectSuccess,13  normalizeAccountId,14  waitNewBlocks,15} from '../util/helpers';1617chai.use(chaiAsPromised);18const expect = chai.expect;19let Alice: IKeyringPair;20let Bob: IKeyringPair;21let Ferdie: IKeyringPair;2223before(async () => {24  await usingApi(async () => {25    Alice = privateKey('//Alice');26    Bob = privateKey('//Bob');27    Ferdie = privateKey('//Ferdie');28  });29});3031describe('Admin vs Owner take token: ', () => {32  // tslint:disable-next-line: max-line-length33  it('The collection admin burns the token and in the same block the token owner performs a transaction on it ', async () => {34    await usingApi(async (api) => {35      const collectionId = await createCollectionExpectSuccess();36      const changeAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));37      await submitTransactionAsync(Alice, changeAdminTx);38      const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');39      //40      const sendItem = api.tx.unique.transfer(normalizeAccountId(Ferdie.address), collectionId, itemId, 1);41      const burnItem = api.tx.unique.burnItem(collectionId, itemId, 1);42      await Promise.all([43        sendItem.signAndSend(Bob),44        burnItem.signAndSend(Alice),45      ]);46      await waitNewBlocks(2);47      let itemBurn = false;48      itemBurn = (await (api.query.unique.nftItemList(collectionId, itemId))).toJSON() as boolean;49      // tslint:disable-next-line: no-unused-expression50      expect(itemBurn).to.be.null;51      await waitNewBlocks(2);52    });53  });54});55*/