difftreelog
tests: add setMintPermission helpers
in: master
1 file changed
tests/src/util/helpers.tsdiffbeforeafterboth606 });606 });607}607}608608609export async function enablePublicMintingExpectSuccess(sender: IKeyringPair, collectionId: number) {609export async function setMintPermissionExpectSuccess(sender: IKeyringPair, collectionId: number, enabled: boolean) {610 await usingApi(async (api) => {610 await usingApi(async (api) => {611611612 // Run the transaction612 // Run the transaction613 const tx = api.tx.nft.setMintPermission(collectionId, true);613 const tx = api.tx.nft.setMintPermission(collectionId, enabled);614 const events = await submitTransactionAsync(sender, tx);614 const events = await submitTransactionAsync(sender, tx);615 const result = getGenericResult(events);615 const result = getGenericResult(events);616616617 // Get the collection617 // Get the collection618 const collection: any = (await api.query.nft.collection(collectionId)).toJSON();618 const collection: any = (await api.query.nft.collection(collectionId)).toJSON();619619620 // What to expect620 // What to expect621 // tslint:disable-next-line:no-unused-expression621 expect(result.success).to.be.true;622 expect(result.success).to.be.true;622 expect(collection.MintMode).to.be.equal(true);623 expect(collection.MintMode).to.be.equal(enabled);623 });624 });624}625}626627export async function enablePublicMintingExpectSuccess(sender: IKeyringPair, collectionId: number) {628 await setMintPermissionExpectSuccess(sender, collectionId, true);629}630631export async function setMintPermissionExpectFailure(sender: IKeyringPair, collectionId: number, enabled: boolean) {632 await usingApi(async (api) => {633 // Run the transaction634 const tx = api.tx.nft.setMintPermission(collectionId, enabled);635 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;636 const result = getCreateCollectionResult(events);637 // tslint:disable-next-line:no-unused-expression638 expect(result.success).to.be.false;639 });640}625641626export async function addToWhiteListExpectSuccess(sender: IKeyringPair, collectionId: number, address: string) {642export async function addToWhiteListExpectSuccess(sender: IKeyringPair, collectionId: number, address: string) {627 await usingApi(async (api) => {643 await usingApi(async (api) => {