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 waitNewBlocks,12} from '../util/helpers';1314chai.use(chaiAsPromised);15const expect = chai.expect;16let Alice: IKeyringPair;17let Ferdie: IKeyringPair;1819before(async () => {20 await usingApi(async () => {21 Alice = privateKey('//Alice');22 Ferdie = privateKey('//Ferdie');23 });24});2526describe('Turns off minting mode: ', () => {27 28 it('The collection owner turns off minting mode and there are minting transactions in the same block ', async () => {29 await usingApi(async (api) => {30 const collectionId = await createCollectionExpectSuccess();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 waitNewBlocks(2);45 });46 });47});