git.delta.rocks / unique-network / refs/commits / 081791eb4c21

difftreelog

source

tests/src/.outdated/collision-tests/admVsOwnerData.test.ts2.7 KiBsourcehistory
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617/* broken by design18// substrate transactions are sequential, not parallel19// the order of execution is indeterminate2021import { IKeyringPair } from '@polkadot/types/types';22import chai from 'chai';23import chaiAsPromised from 'chai-as-promised';24import privateKey from '../substrate/privateKey';25import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';26import {27  createCollectionExpectSuccess,28  createItemExpectSuccess,29  normalizeAccountId,30  waitNewBlocks,31} from '../util/helpers';3233chai.use(chaiAsPromised);34const expect = chai.expect;35let Alice: IKeyringPair;36let Bob: IKeyringPair;3738before(async () => {39  await usingApi(async () => {40    Alice = privateKey('//Alice');41    Bob = privateKey('//Bob');42  });43});4445describe('Admin vs Owner changes the data in the token: ', () => {46  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 () => {47    await usingApi(async (api) => {48      const AliceData = 1;49      const BobData = 2;50      const collectionId = await createCollectionExpectSuccess();51      const changeAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));52      await submitTransactionAsync(Alice, changeAdminTx);53      const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');54      //55      // tslint:disable-next-line: max-line-length56      const AliceTx = api.tx.unique.setVariableMetaData(collectionId, itemId, AliceData.toString());57      // tslint:disable-next-line: max-line-length58      const BobTx = api.tx.unique.setVariableMetaData(collectionId, itemId, BobData.toString());59      await Promise.all([60        AliceTx.signAndSend(Alice),61        BobTx.signAndSend(Bob),62      ]);63      const item: any = await api.query.unique.nftItemList(collectionId, itemId);64      expect(item.variableData).not.to.be.eq(null); // Pseudo-random selection of one of two values65      await waitNewBlocks(2);66    });67  });68});69*/