git.delta.rocks / unique-network / refs/commits / 8a261a0dc8a0

difftreelog

tests: disableWhiteListExpectSuccess helper

Yaroslav Bolyukin2021-01-27parent: #4622c7c.patch.diff
in: master

1 file changed

modifiedtests/src/util/helpers.tsdiffbeforeafterboth
605 return newItemId;605 return newItemId;
606}606}
607607
608export async function enableWhiteListExpectSuccess(sender: IKeyringPair, collectionId: number) {608export async function setPublicAccessModeExpectSuccess(
609 sender: IKeyringPair, collectionId: number,
610 accessMode: 'Normal' | 'WhiteList',
611) {
609 await usingApi(async (api) => {612 await usingApi(async (api) => {
610613
611 // Run the transaction614 // Run the transaction
612 const tx = api.tx.nft.setPublicAccessMode(collectionId, 'WhiteList');615 const tx = api.tx.nft.setPublicAccessMode(collectionId, accessMode);
613 const events = await submitTransactionAsync(sender, tx);616 const events = await submitTransactionAsync(sender, tx);
614 const result = getGenericResult(events);617 const result = getGenericResult(events);
615618
619 // What to expect622 // What to expect
620 // tslint:disable-next-line:no-unused-expression623 // tslint:disable-next-line:no-unused-expression
621 expect(result.success).to.be.true;624 expect(result.success).to.be.true;
622 expect(collection.Access).to.be.equal('WhiteList');625 expect(collection.Access).to.be.equal(accessMode);
623 });626 });
624}627}
628
629export async function enableWhiteListExpectSuccess(sender: IKeyringPair, collectionId: number) {
630 await setPublicAccessModeExpectSuccess(sender, collectionId, 'WhiteList');
631}
632
633export async function disableWhiteListExpectSuccess(sender: IKeyringPair, collectionId: number) {
634 await setPublicAccessModeExpectSuccess(sender, collectionId, 'Normal');
635}
625636
626export async function enablePublicMintingExpectSuccess(sender: IKeyringPair, collectionId: number) {637export async function enablePublicMintingExpectSuccess(sender: IKeyringPair, collectionId: number) {
627 await usingApi(async (api) => {638 await usingApi(async (api) => {