git.delta.rocks / unique-network / refs/commits / 1e0a302bebd7

difftreelog

CORE-37. Integration tests

str-mv2021-07-16parent: #dab0214.patch.diff
in: master

2 files changed

addedtests/src/metadataUpdate.test.tsdiffbeforeafterboth

no changes

modifiedtests/src/util/helpers.tsdiffbeforeafterboth
503 });503 });
504}504}
505
506export async function setMetadataUpdatePermissionFlagExpectSuccess(sender: IKeyringPair, collectionId: number, flag: string) {
507
508 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);
512
513 expect(result.success).to.be.true;
514 });
515}
516
517export async function setMetadataUpdatePermissionFlagExpectFailure(sender: IKeyringPair, collectionId: number, flag: string) {
518
519 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);
523
524 expect(result.success).to.be.false;
525 });
526}
505527
506export 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}
1010
1011export 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}
9881019
989export 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) => {