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} from '../util/helpers';1112chai.use(chaiAsPromised);13const expect = chai.expect;14let Alice: IKeyringPair;15let Ferdie: IKeyringPair;1617before(async () => {18 await usingApi(async () => {19 Alice = privateKey('//Alice');20 Ferdie = privateKey('//Ferdie');21 });22});2324describe('Turns off minting mode: ', () => {25 26 it('The collection owner turns off minting mode and there are minting transactions in the same block ', async () => {27 await usingApi(async (api) => {28 const collectionId = await createCollectionExpectSuccess();29 const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));30 await setMintPermissionExpectSuccess(Alice, collectionId, true);31 await addToWhiteListExpectSuccess(Alice, collectionId, Ferdie.address);3233 const mintItem = api.tx.nft.createItem(collectionId, Ferdie.address, 'NFT');34 const offMinting = api.tx.nft.setMintPermission(collectionId, false);35 await Promise.all([36 mintItem.signAndSend(Ferdie),37 offMinting.signAndSend(Alice),38 ]);39 let itemList = false;40 itemList = (await (api.query.nft.nftItemList(collectionId, mintItem))).toJSON() as boolean;41 42 expect(itemList).to.be.null;43 await timeoutPromise(20000);44 });45 });46});