git.delta.rocks / unique-network / refs/commits / 027824533e7e

difftreelog

test use new burn value logic

Yaroslav Bolyukin2021-10-11parent: #91ce31e.patch.diff
in: master

3 files changed

modifiedtests/src/burnItem.test.tsdiffbeforeafterboth
92 });92 });
93 });93 });
9494
95 it.only('Burn owned portion of item in ReFungible collection', async () => {95 it('Burn owned portion of item in ReFungible collection', async () => {
96 const createMode = 'ReFungible';96 const createMode = 'ReFungible';
97 const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});97 const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});
98 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);98 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);
107 const balanceBefore: any = (await api.query.nft.reFungibleItemList(collectionId, tokenId)).toJSON();107 const balanceBefore: any = (await api.query.nft.reFungibleItemList(collectionId, tokenId)).toJSON();
108108
109 // Bob burns his portion109 // Bob burns his portion
110 const tx = api.tx.nft.burnItem(collectionId, tokenId, 0);110 const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);
111 const events2 = await submitTransactionAsync(bob, tx);111 const events2 = await submitTransactionAsync(bob, tx);
112 const result2 = getGenericResult(events2);112 const result2 = getGenericResult(events2);
113113
114 // Get balances 114 // Get balances
115 const balance: any = (await api.query.nft.reFungibleItemList(collectionId, tokenId)).toJSON();115 const balance: any = (await api.query.nft.reFungibleItemList(collectionId, tokenId)).toJSON();
116 // console.log(balance);116 // console.log(balance);
117 117
152 await addCollectionAdminExpectSuccess(alice, collectionId, bob);152 await addCollectionAdminExpectSuccess(alice, collectionId, bob);
153153
154 await usingApi(async (api) => {154 await usingApi(async (api) => {
155 const tx = api.tx.nft.burnItem(collectionId, tokenId, 0);155 const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);
156 const events = await submitTransactionAsync(bob, tx);156 const events = await submitTransactionAsync(bob, tx);
157 const result = getGenericResult(events);157 const result = getGenericResult(events);
158 // Get the item158 // Get the item
166 });166 });
167167
168168
169 it.only('Burn item in Fungible collection', async () => {169 it('Burn item in Fungible collection', async () => {
170 const createMode = 'Fungible';170 const createMode = 'Fungible';
171 const collectionId = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0 }});171 const collectionId = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0 }});
172 await createItemExpectSuccess(alice, collectionId, createMode); // Helper creates 10 fungible tokens172 await createItemExpectSuccess(alice, collectionId, createMode); // Helper creates 10 fungible tokens
179 const events = await submitTransactionAsync(bob, tx);179 const events = await submitTransactionAsync(bob, tx);
180 const result = getGenericResult(events);180 const result = getGenericResult(events);
181 181
182 // Get alice balance 182 // Get alice balance
183 const balance: any = (await api.query.nft.fungibleItemList(collectionId, alice.address)).toJSON();183 const balance: any = (await api.query.nft.fungibleItemList(collectionId, alice.address)).toJSON();
184 184
185 // What to expect185 // What to expect
189 });189 });
190 });190 });
191 191
192 it.only('Burn item in ReFungible collection', async () => {192 it('Burn item in ReFungible collection', async () => {
193 const createMode = 'ReFungible';193 const createMode = 'ReFungible';
194 const collectionId = await createCollectionExpectSuccess({mode: {type: createMode }});194 const collectionId = await createCollectionExpectSuccess({mode: {type: createMode }});
195 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);195 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);
196 await addCollectionAdminExpectSuccess(alice, collectionId, bob);196 await addCollectionAdminExpectSuccess(alice, collectionId, bob);
197197
198 await usingApi(async (api) => {198 await usingApi(async (api) => {
199 const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);199 const tx = api.tx.nft.burnItem(collectionId, tokenId, 100);
200 const events = await submitTransactionAsync(bob, tx);200 const events = await submitTransactionAsync(bob, tx);
201 const result = getGenericResult(events);201 const result = getGenericResult(events);
202 // Get alice balance 202 // Get alice balance
203 const balance: any = (await api.query.nft.reFungibleItemList(collectionId, tokenId)).toJSON();203 const balance: any = (await api.query.nft.reFungibleItemList(collectionId, tokenId)).toJSON();
204 204
205 // What to expect205 // What to expect
modifiedtests/src/transfer.test.tsdiffbeforeafterboth
--- a/tests/src/transfer.test.ts
+++ b/tests/src/transfer.test.ts
@@ -184,7 +184,7 @@
       1,
     );
   });
-  it.only('Transfer with deleted item_id', async () => {
+  it('Transfer with deleted item_id', async () => {
     // nft
     const nftCollectionId = await createCollectionExpectSuccess();
     const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');
@@ -199,7 +199,7 @@
     const reFungibleCollectionId = await
     createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
     const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');
-    await burnItemExpectSuccess(Alice, reFungibleCollectionId, newReFungibleTokenId, 1);
+    await burnItemExpectSuccess(Alice, reFungibleCollectionId, newReFungibleTokenId, 100);
     await transferExpectFailure(
       reFungibleCollectionId,
       newReFungibleTokenId,
modifiedtests/src/transferFrom.test.tsdiffbeforeafterboth
--- a/tests/src/transferFrom.test.ts
+++ b/tests/src/transferFrom.test.ts
@@ -248,19 +248,19 @@
       const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');
       await burnItemExpectSuccess(Alice, nftCollectionId, newNftTokenId, 1);
       await approveExpectFail(nftCollectionId, newNftTokenId, Alice, Bob);
-      await transferFromExpectFail(nftCollectionId, newNftTokenId, Bob, Alice, Charlie, 1);      
+      await transferFromExpectFail(nftCollectionId, newNftTokenId, Bob, Alice, Charlie, 1);
     });
   });
-  it.only( 'transferFrom burnt token before approve Fungible', async () => {
+  it( 'transferFrom burnt token before approve Fungible', async () => {
     await usingApi(async () => {
       const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
       const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');
       await burnItemExpectSuccess(Alice, fungibleCollectionId, 1, 10);
       await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, Alice, Bob);
       await transferFromExpectFail(fungibleCollectionId, newFungibleTokenId, Bob, Alice, Charlie, 1);
-          
+
     });
-  }); 
+  });
   it( 'transferFrom burnt token before approve ReFungible', async () => {
     await usingApi(async () => {
       const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
@@ -268,38 +268,38 @@
       await burnItemExpectSuccess(Alice, reFungibleCollectionId, newReFungibleTokenId, 1);
       await approveExpectFail(reFungibleCollectionId, newReFungibleTokenId, Alice, Bob);
       await transferFromExpectFail(reFungibleCollectionId, newReFungibleTokenId, Bob, Alice, Charlie, 1);
-          
+
     });
   });
-  
-  it.only( 'transferFrom burnt token after approve NFT', async () => {
+
+  it( 'transferFrom burnt token after approve NFT', async () => {
     await usingApi(async () => {
       // nft
       const nftCollectionId = await createCollectionExpectSuccess();
       const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');
       await approveExpectSuccess(nftCollectionId, newNftTokenId, Alice, Bob);
       await burnItemExpectSuccess(Alice, nftCollectionId, newNftTokenId, 1);
-      await transferFromExpectFail(nftCollectionId, newNftTokenId, Bob, Alice, Charlie, 1);      
+      await transferFromExpectFail(nftCollectionId, newNftTokenId, Bob, Alice, Charlie, 1);
     });
   });
-  it.only( 'transferFrom burnt token after approve Fungible', async () => {
+  it( 'transferFrom burnt token after approve Fungible', async () => {
     await usingApi(async () => {
       const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
       const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');
       await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, Alice, Bob);
       await burnItemExpectSuccess(Alice, fungibleCollectionId, 1, 10);
       await transferFromExpectFail(fungibleCollectionId, newFungibleTokenId, Bob, Alice, Charlie, 1);
-          
+
     });
-  }); 
-  it.only( 'transferFrom burnt token after approve ReFungible', async () => {
+  });
+  it( 'transferFrom burnt token after approve ReFungible', async () => {
     await usingApi(async () => {
       const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
       const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');
       await approveExpectSuccess(reFungibleCollectionId, newReFungibleTokenId, Alice, Bob);
-      await burnItemExpectSuccess(Alice, reFungibleCollectionId, newReFungibleTokenId, 1);
+      await burnItemExpectSuccess(Alice, reFungibleCollectionId, newReFungibleTokenId, 100);
       await transferFromExpectFail(reFungibleCollectionId, newReFungibleTokenId, Bob, Alice, Charlie, 1);
-          
+
     });
   });