1import { IKeyringPair } from '@polkadot/types/types';2import chai from 'chai';3import chaiAsPromised from 'chai-as-promised';4import privateKey from '../substrate/privateKey';5import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';6import {7 createCollectionExpectSuccess,8 createItemExpectSuccess,9} from '../util/helpers';1011chai.use(chaiAsPromised);12const expect = chai.expect;13let Alice: IKeyringPair;14let Bob: IKeyringPair;1516before(async () => {17 await usingApi(async () => {18 Alice = privateKey('//Alice');19 Bob = privateKey('//Bob');20 });21});2223describe('Admin vs Owner changes the data in the token: ', () => {24 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 () => {25 await usingApi(async (api) => {26 const AliceData = 1;27 const BobData = 2;28 const collectionId = await createCollectionExpectSuccess();29 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, Bob.address);30 await submitTransactionAsync(Alice, changeAdminTx);31 const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));32 const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');33 34 35 const AliceTx = api.tx.nft.setVariableMetaData(collectionId, itemId, AliceData.toString());36 37 const BobTx = api.tx.nft.setVariableMetaData(collectionId, itemId, BobData.toString());38 await Promise.all([39 AliceTx.signAndSend(Alice),40 BobTx.signAndSend(Bob),41 ]);42 const item: any = await api.query.nft.nftItemList(collectionId, itemId);43 expect(item.VariableData).not.to.be.eq(null); 44 await timeoutPromise(20000);45 });46 });47});