git.delta.rocks / unique-network / refs/commits / 2df3f6b6e145

difftreelog

source

tests/src/.outdated/collision-tests/turnsOffMinting.test.ts2.5 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 from '../substrate/substrate-api';26import {27  addToAllowListExpectSuccess,28  createCollectionExpectSuccess,29  setMintPermissionExpectSuccess,30  normalizeAccountId,31  waitNewBlocks,32} from '../util/helpers';3334chai.use(chaiAsPromised);35const expect = chai.expect;36let Alice: IKeyringPair;37let Ferdie: IKeyringPair;3839before(async () => {40  await usingApi(async () => {41    Alice = privateKey('//Alice');42    Ferdie = privateKey('//Ferdie');43  });44});4546describe('Turns off minting mode: ', () => {47  // tslint:disable-next-line: max-line-length48  it('The collection owner turns off minting mode and there are minting transactions in the same block ', async () => {49    await usingApi(async (api) => {50      const collectionId = await createCollectionExpectSuccess();51      await setMintPermissionExpectSuccess(Alice, collectionId, true);52      await addToAllowListExpectSuccess(Alice, collectionId, Ferdie.address);5354      const mintItem = api.tx.unique.createItem(collectionId, normalizeAccountId(Ferdie.address), 'NFT');55      const offMinting = api.tx.unique.setMintPermission(collectionId, false);56      await Promise.all([57        mintItem.signAndSend(Ferdie),58        offMinting.signAndSend(Alice),59      ]);60      let itemList = false;61      itemList = (await (api.query.unique.nftItemList(collectionId, mintItem))).toJSON() as boolean;62      // tslint:disable-next-line: no-unused-expression63      expect(itemList).to.be.null;64      await waitNewBlocks(2);65    });66  });67});68*/