1import { IKeyringPair } from '@polkadot/types/types';2import chai from 'chai';3import chaiAsPromised from 'chai-as-promised';4import privateKey from '../substrate/privateKey';5import usingApi from '../substrate/substrate-api';6import {7 addToWhiteListExpectSuccess,8 createCollectionExpectSuccess,9 setMintPermissionExpectSuccess,10 normalizeAccountId,11} from '../util/helpers';1213chai.use(chaiAsPromised);14const expect = chai.expect;15let Alice: IKeyringPair;16let Ferdie: IKeyringPair;1718before(async () => {19 await usingApi(async () => {20 Alice = privateKey('//Alice');21 Ferdie = privateKey('//Ferdie');22 });23});2425describe('Turns off minting mode: ', () => {26 27 it('The collection owner turns off minting mode and there are minting transactions in the same block ', async () => {28 await usingApi(async (api) => {29 const collectionId = await createCollectionExpectSuccess();30 const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));31 await setMintPermissionExpectSuccess(Alice, collectionId, true);32 await addToWhiteListExpectSuccess(Alice, collectionId, Ferdie.address);3334 const mintItem = api.tx.nft.createItem(collectionId, normalizeAccountId(Ferdie.address), 'NFT');35 const offMinting = api.tx.nft.setMintPermission(collectionId, false);36 await Promise.all([37 mintItem.signAndSend(Ferdie),38 offMinting.signAndSend(Alice),39 ]);40 let itemList = false;41 itemList = (await (api.query.nft.nftItemList(collectionId, mintItem))).toJSON() as boolean;42 43 expect(itemList).to.be.null;44 await timeoutPromise(20000);45 });46 });47});