difftreelog
Add test: user can't disable limits
in: master
1 file changed
tests/src/eth/collectionLimits.test.tsdiffbeforeafterboth85 const {collectionAddress} = await helper.eth.createCollection(testCase.case, owner, 'Limits', 'absolutely anything', 'ISNI', 18);85 const {collectionAddress} = await helper.eth.createCollection(testCase.case, owner, 'Limits', 'absolutely anything', 'ISNI', 18);86 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);86 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);8788 // Cannot set non-existing limit87 await expect(collectionEvm.methods89 await expect(collectionEvm.methods88 .setCollectionLimit(20, true, 1)90 .setCollectionLimit(9, true, 1)89 .call()).to.be.rejectedWith('Returned error: VM Exception while processing transaction: revert Value not convertible into enum "CollectionLimits"');91 .call()).to.be.rejectedWith('Returned error: VM Exception while processing transaction: revert Value not convertible into enum "CollectionLimits"'); 90 92 93 // Cannot disable limits94 await expect(collectionEvm.methods95 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, false, 200)96 .call()).to.be.rejectedWith('Returned error: VM Exception while processing transaction: revert user can\'t disable limits');9791 await expect(collectionEvm.methods98 await expect(collectionEvm.methods92 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, BigInt(Number.MAX_SAFE_INTEGER))99 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, invalidLimits.accountTokenOwnershipLimit)93 .call()).to.be.rejectedWith(`can't convert value to u32 "${invalidLimits.accountTokenOwnershipLimit}"`);100 .call()).to.be.rejectedWith(`can't convert value to u32 "${invalidLimits.accountTokenOwnershipLimit}"`);94 101 95 await expect(collectionEvm.methods102 await expect(collectionEvm.methods96 .setCollectionLimit(CollectionLimits.TransferEnabled, true, 3)103 .setCollectionLimit(CollectionLimits.TransferEnabled, true, 3)97 .call()).to.be.rejectedWith(`can't convert value to boolean "${invalidLimits.transfersEnabled}"`);104 .call()).to.be.rejectedWith(`can't convert value to boolean "${invalidLimits.transfersEnabled}"`);105106 await expect(collectionEvm.methods107 .setCollectionLimit(CollectionLimits.SponsoredDataSize, true, -1)108 .call()).to.be.rejectedWith('Error: value out-of-bounds (argument="value", value=-1, code=INVALID_ARGUMENT');98 }));109 }));99});110});100111