difftreelog
CORE-37. Integration tests
in: master
2 files changed
tests/src/metadataUpdate.test.tsdiffbeforeafterbothno changes
tests/src/util/helpers.tsdiffbeforeafterboth503 });503 });504}504}505506export async function setMetadataUpdatePermissionFlagExpectSuccess(sender: IKeyringPair, collectionId: number, flag: string) {507508 await usingApi(async (api) => {509 const tx = api.tx.nft.setMetaUpdatePermissionFlag(collectionId, flag); 510 const events = await submitTransactionAsync(sender, tx);511 const result = getGenericResult(events);512513 expect(result.success).to.be.true;514 }); 515}516517export async function setMetadataUpdatePermissionFlagExpectFailure(sender: IKeyringPair, collectionId: number, flag: string) {518519 await usingApi(async (api) => {520 const tx = api.tx.nft.setMetaUpdatePermissionFlag(collectionId, flag); 521 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;522 const result = getGenericResult(events);523524 expect(result.success).to.be.false;525 }); 526}505527506export async function enableContractSponsoringExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, enable: boolean) {528export async function enableContractSponsoringExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, enable: boolean) {507 await usingApi(async (api) => {529 await usingApi(async (api) => {986 await setMintPermissionExpectSuccess(sender, collectionId, true);1008 await setMintPermissionExpectSuccess(sender, collectionId, true);987}1009}10101011export async function addCollectionAdminExpectSuccess(sender: IKeyringPair, collectionId: number, address: IKeyringPair) {1012 await usingApi(async (api) => {1013 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(address.address));1014 const events = await submitTransactionAsync(sender, changeAdminTx);1015 const result = getCreateCollectionResult(events);1016 expect(result.success).to.be.true;1017 });1018}9881019989export async function setMintPermissionExpectFailure(sender: IKeyringPair, collectionId: number, enabled: boolean) {1020export async function setMintPermissionExpectFailure(sender: IKeyringPair, collectionId: number, enabled: boolean) {990 await usingApi(async (api) => {1021 await usingApi(async (api) => {