difftreelog
test use new burn value logic
in: master
3 files changed
tests/src/burnItem.test.tsdiffbeforeafterboth92 });92 });93 });93 });949495 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();108108109 // Bob burns his portion109 // Bob burns his portion110 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);113113114 // Get balances 114 // Get balances115 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 117152 await addCollectionAdminExpectSuccess(alice, collectionId, bob);152 await addCollectionAdminExpectSuccess(alice, collectionId, bob);153153154 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 item166 });166 });167167168168169 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 tokens179 const events = await submitTransactionAsync(bob, tx);179 const events = await submitTransactionAsync(bob, tx);180 const result = getGenericResult(events);180 const result = getGenericResult(events);181 181182 // Get alice balance 182 // Get alice balance183 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 184185 // What to expect185 // What to expect189 });189 });190 });190 });191 191192 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);197197198 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 balance203 const balance: any = (await api.query.nft.reFungibleItemList(collectionId, tokenId)).toJSON();203 const balance: any = (await api.query.nft.reFungibleItemList(collectionId, tokenId)).toJSON();204 204205 // What to expect205 // What to expecttests/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,
tests/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);
-
+
});
});