git.delta.rocks / unique-network / refs/commits / 7d1f2b113d9c

difftreelog

Add test: user can't disable limits

Max Andreev2022-12-09parent: #afa8f97.patch.diff
in: master

1 file changed

modifiedtests/src/eth/collectionLimits.test.tsdiffbeforeafterboth
85 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);
87
88 // Cannot set non-existing limit
87 await expect(collectionEvm.methods89 await expect(collectionEvm.methods
88 .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 limits
94 await expect(collectionEvm.methods
95 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, false, 200)
96 .call()).to.be.rejectedWith('Returned error: VM Exception while processing transaction: revert user can\'t disable limits');
97
91 await expect(collectionEvm.methods98 await expect(collectionEvm.methods
92 .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.methods
96 .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}"`);
105
106 await expect(collectionEvm.methods
107 .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