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;2122before(async () => {23 await usingApi(async () => {24 Alice = privateKey('//Alice');25 Bob = privateKey('//Bob');26 });27});2829describe('Admin vs Owner changes the data in the token: ', () => {30 it('The collection admin changes the data in the token and in the same block the token owner also changes the data in it ', async () => {31 await usingApi(async (api) => {32 const AliceData = 1;33 const BobData = 2;34 const collectionId = await createCollectionExpectSuccess();35 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));36 await submitTransactionAsync(Alice, changeAdminTx);37 const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');38 //39 // tslint:disable-next-line: max-line-length40 const AliceTx = api.tx.nft.setVariableMetaData(collectionId, itemId, AliceData.toString());41 // tslint:disable-next-line: max-line-length42 const BobTx = api.tx.nft.setVariableMetaData(collectionId, itemId, BobData.toString());43 await Promise.all([44 AliceTx.signAndSend(Alice),45 BobTx.signAndSend(Bob),46 ]);47 const item: any = await api.query.nft.nftItemList(collectionId, itemId);48 expect(item.variableData).not.to.be.eq(null); // Pseudo-random selection of one of two values49 await waitNewBlocks(2);50 });51 });52});53*/difftreelog
source
tests/src/collision-tests/admVsOwnerData.test.ts1.9 KiBsourcehistory