difftreelog
Add permition tests
in: master
1 file changed
tests/src/eth/collectionLimits.test.tsdiffbeforeafterboth120 .setCollectionLimit(CollectionLimits.SponsoredDataSize, true, -1).send()).to.throw('value out-of-bounds');120 .setCollectionLimit(CollectionLimits.SponsoredDataSize, true, -1).send()).to.throw('value out-of-bounds');121 }));121 }));122123 [124 {case: 'nft' as const, method: 'createNFTCollection' as const},125 {case: 'rft' as const, method: 'createRFTCollection' as const, requiredPallets: [Pallets.ReFungible]},126 {case: 'ft' as const, method: 'createFTCollection' as const},127 ].map(testCase =>128 itEth.ifWithPallets(`Non-owner and non-admin cannot set collection limits for ${testCase.case}`, testCase.requiredPallets || [], async ({helper}) => {129 const owner = await helper.eth.createAccountWithBalance(donor);130 const nonOwner = await helper.eth.createAccountWithBalance(donor);131 const {collectionAddress} = await helper.eth.createCollecion(testCase.method, owner, 'Limits', 'absolutely anything', 'FLO', 18);132133 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);134 await expect(collectionEvm.methods135 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)136 .call({from: nonOwner}))137 .to.be.rejectedWith('NoPermission');138139 await expect(collectionEvm.methods140 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)141 .send({from: nonOwner}))142 .to.be.rejected;143 }));122});144});123145