difftreelog
Update transfer disable tests
in: master
3 files changed
tests/package.jsondiffbeforeafterboth--- a/tests/package.json
+++ b/tests/package.json
@@ -59,7 +59,8 @@
"testSetVariableMetadataSponsoringRateLimit": "mocha --timeout 9999999 -r ts-node/register ./**/setVariableMetadataSponsoringRateLimit.test.ts",
"testInflation": "mocha --timeout 9999999 -r ts-node/register ./**/inflation.test.ts",
"testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts",
- "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts"
+ "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts",
+ "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts"
},
"author": "",
"license": "SEE LICENSE IN ../LICENSE",
tests/src/enableDisableTransfer.test.tsdiffbeforeafterboth--- a/tests/src/enableDisableTransfer.test.ts
+++ b/tests/src/enableDisableTransfer.test.ts
@@ -13,6 +13,7 @@
transferExpectSuccess,
transferExpectFailure,
setTransferFlagExpectSuccess,
+ setTransferFlagExpectFailure,
} from './util/helpers';
chai.use(chaiAsPromised);
@@ -48,3 +49,16 @@
});
});
});
+
+describe('Negative Enable/Disable Transfers', () => {
+ it('Non-owner cannot change transfer flag', async () => {
+ await usingApi(async () => {
+ const Bob = privateKey('//Bob');
+ // nft
+ const nftCollectionId = await createCollectionExpectSuccess();
+
+ // Change transfer flag
+ await setTransferFlagExpectFailure(Bob, nftCollectionId, false);
+ });
+ });
+});
tests/src/util/helpers.tsdiffbeforeafterboth535 }); 535 }); 536}536}537538export async function setTransferFlagExpectFailure(sender: IKeyringPair, collectionId: number, enabled: boolean) {539540 await usingApi(async (api) => {541542 const tx = api.tx.nft.setTransfersEnabledFlag (collectionId, enabled);543 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;544 const result = getGenericResult(events);545546 expect(result.success).to.be.false;547 }); 548}537549538export async function setContractSponsoringRateLimitExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, rateLimit: number) {550export async function setContractSponsoringRateLimitExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, rateLimit: number) {539 await usingApi(async (api) => {551 await usingApi(async (api) => {