git.delta.rocks / unique-network / refs/commits / 185ad3642ef5

difftreelog

Add destroyCollection checks

Max Andreev2022-12-03parent: #2849d0e.patch.diff
in: master

4 files changed

modifiedtests/src/eth/createFTCollection.test.tsdiffbeforeafterboth
144 144
145 itEth('destroyCollection', async ({helper}) => {145 itEth('destroyCollection', async ({helper}) => {
146 const owner = await helper.eth.createAccountWithBalance(donor);146 const owner = await helper.eth.createAccountWithBalance(donor);
147 const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Exister', DECIMALS, 'absolutely anything', 'WIWT');147 const {collectionAddress, collectionId} = await helper.eth.createFungibleCollection(owner, 'Exister', DECIMALS, 'absolutely anything', 'WIWT');
148 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);148 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
149149
150 const result = await collectionHelper.methods150 const result = await collectionHelper.methods
166 expect(await collectionHelper.methods166 expect(await collectionHelper.methods
167 .isCollectionExist(collectionAddress)167 .isCollectionExist(collectionAddress)
168 .call()).to.be.false;168 .call()).to.be.false;
169 expect(await helper.collection.getData(collectionId)).to.be.null;
169 });170 });
170});171});
171172
modifiedtests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createNFTCollection.test.ts
+++ b/tests/src/eth/createNFTCollection.test.ts
@@ -308,7 +308,7 @@
 
   itEth('destroyCollection', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
-    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');
+    const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');
     const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
 
 
@@ -331,5 +331,6 @@
     expect(await collectionHelper.methods
       .isCollectionExist(collectionAddress)
       .call()).to.be.false;
+    expect(await helper.collection.getData(collectionId)).to.be.null;
   });
 });
\ No newline at end of file
modifiedtests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createRFTCollection.test.ts
+++ b/tests/src/eth/createRFTCollection.test.ts
@@ -340,7 +340,7 @@
   
   itEth('destroyCollection', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
-    const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');
+    const {collectionAddress, collectionId} = await helper.eth.createRFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');
     const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
     
     await expect(collectionHelper.methods
@@ -349,6 +349,7 @@
     
     expect(await collectionHelper.methods
       .isCollectionExist(collectionAddress)
-      .call()).to.be.false;  
+      .call()).to.be.false;
+    expect(await helper.collection.getData(collectionId)).to.be.null;
   });
 });
modifiedtests/src/eth/destroyCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/destroyCollection.test.ts
+++ b/tests/src/eth/destroyCollection.test.ts
@@ -33,7 +33,7 @@
   });
 
   testCases.map((testCase) => 
-    itEth.ifWithPallets(`(!negative test!) ${testCase.method}`, testCase.requiredPallets, async ({helper}) => {
+    itEth.ifWithPallets(`Cannot burn non-owned or non-existing collection ${testCase.method}`, testCase.requiredPallets, async ({helper}) => {
       const owner = await helper.eth.createAccountWithBalance(donor);
       const signer = await helper.eth.createAccountWithBalance(donor);