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 normalizeAccountId,10 waitNewBlocks,11} from '../util/helpers';1213chai.use(chaiAsPromised);14const expect = chai.expect;15let Alice: IKeyringPair;16let Bob: IKeyringPair;1718before(async () => {19 await usingApi(async () => {20 Alice = privateKey('//Alice');21 Bob = privateKey('//Bob');22 });23});2425describe('Admin vs Owner changes the data in the token: ', () => {26 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 () => {27 await usingApi(async (api) => {28 const AliceData = 1;29 const BobData = 2;30 const collectionId = await createCollectionExpectSuccess();31 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));32 await submitTransactionAsync(Alice, changeAdminTx);33 const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');34 35 36 const AliceTx = api.tx.nft.setVariableMetaData(collectionId, itemId, AliceData.toString());37 38 const BobTx = api.tx.nft.setVariableMetaData(collectionId, itemId, BobData.toString());39 await Promise.all([40 AliceTx.signAndSend(Alice),41 BobTx.signAndSend(Bob),42 ]);43 const item: any = await api.query.nft.nftItemList(collectionId, itemId);44 expect(item.variableData).not.to.be.eq(null); 45 await waitNewBlocks(2);46 });47 });48});