difftreelog
test use new burn value logic
in: master
3 files changed
tests/src/burnItem.test.tsdiffbeforeafterboth--- a/tests/src/burnItem.test.ts
+++ b/tests/src/burnItem.test.ts
@@ -92,7 +92,7 @@
});
});
- it.only('Burn owned portion of item in ReFungible collection', async () => {
+ it('Burn owned portion of item in ReFungible collection', async () => {
const createMode = 'ReFungible';
const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});
const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);
@@ -107,14 +107,14 @@
const balanceBefore: any = (await api.query.nft.reFungibleItemList(collectionId, tokenId)).toJSON();
// Bob burns his portion
- const tx = api.tx.nft.burnItem(collectionId, tokenId, 0);
+ const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);
const events2 = await submitTransactionAsync(bob, tx);
const result2 = getGenericResult(events2);
- // Get balances
+ // Get balances
const balance: any = (await api.query.nft.reFungibleItemList(collectionId, tokenId)).toJSON();
// console.log(balance);
-
+
// What to expect before burning
expect(result1.success).to.be.true;
expect(balanceBefore).to.be.not.null;
@@ -152,7 +152,7 @@
await addCollectionAdminExpectSuccess(alice, collectionId, bob);
await usingApi(async (api) => {
- const tx = api.tx.nft.burnItem(collectionId, tokenId, 0);
+ const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);
const events = await submitTransactionAsync(bob, tx);
const result = getGenericResult(events);
// Get the item
@@ -166,7 +166,7 @@
});
- it.only('Burn item in Fungible collection', async () => {
+ it('Burn item in Fungible collection', async () => {
const createMode = 'Fungible';
const collectionId = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0 }});
await createItemExpectSuccess(alice, collectionId, createMode); // Helper creates 10 fungible tokens
@@ -178,30 +178,30 @@
const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);
const events = await submitTransactionAsync(bob, tx);
const result = getGenericResult(events);
-
- // Get alice balance
+
+ // Get alice balance
const balance: any = (await api.query.nft.fungibleItemList(collectionId, alice.address)).toJSON();
-
+
// What to expect
expect(result.success).to.be.true;
expect(balance).to.be.not.null;
expect(balance.Value).to.be.equal(9);
});
});
-
- it.only('Burn item in ReFungible collection', async () => {
+
+ it('Burn item in ReFungible collection', async () => {
const createMode = 'ReFungible';
const collectionId = await createCollectionExpectSuccess({mode: {type: createMode }});
const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);
await addCollectionAdminExpectSuccess(alice, collectionId, bob);
await usingApi(async (api) => {
- const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);
+ const tx = api.tx.nft.burnItem(collectionId, tokenId, 100);
const events = await submitTransactionAsync(bob, tx);
const result = getGenericResult(events);
- // Get alice balance
+ // Get alice balance
const balance: any = (await api.query.nft.reFungibleItemList(collectionId, tokenId)).toJSON();
-
+
// What to expect
expect(result.success).to.be.true;
expect(balance).to.be.null;
tests/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.tsdiffbeforeafterboth251 await transferFromExpectFail(nftCollectionId, newNftTokenId, Bob, Alice, Charlie, 1); 251 await transferFromExpectFail(nftCollectionId, newNftTokenId, Bob, Alice, Charlie, 1);252 });252 });253 });253 });254 it.only( 'transferFrom burnt token before approve Fungible', async () => {254 it( 'transferFrom burnt token before approve Fungible', async () => {255 await usingApi(async () => {255 await usingApi(async () => {256 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});256 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});257 const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');257 const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');272 });272 });273 });273 });274 274275 it.only( 'transferFrom burnt token after approve NFT', async () => {275 it( 'transferFrom burnt token after approve NFT', async () => {276 await usingApi(async () => {276 await usingApi(async () => {277 // nft277 // nft278 const nftCollectionId = await createCollectionExpectSuccess();278 const nftCollectionId = await createCollectionExpectSuccess();282 await transferFromExpectFail(nftCollectionId, newNftTokenId, Bob, Alice, Charlie, 1); 282 await transferFromExpectFail(nftCollectionId, newNftTokenId, Bob, Alice, Charlie, 1);283 });283 });284 });284 });285 it.only( 'transferFrom burnt token after approve Fungible', async () => {285 it( 'transferFrom burnt token after approve Fungible', async () => {286 await usingApi(async () => {286 await usingApi(async () => {287 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});287 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});288 const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');288 const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');292 292293 });293 });294 }); 294 });295 it.only( 'transferFrom burnt token after approve ReFungible', async () => {295 it( 'transferFrom burnt token after approve ReFungible', async () => {296 await usingApi(async () => {296 await usingApi(async () => {297 const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});297 const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});298 const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');298 const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');299 await approveExpectSuccess(reFungibleCollectionId, newReFungibleTokenId, Alice, Bob);299 await approveExpectSuccess(reFungibleCollectionId, newReFungibleTokenId, Alice, Bob);300 await burnItemExpectSuccess(Alice, reFungibleCollectionId, newReFungibleTokenId, 1);300 await burnItemExpectSuccess(Alice, reFungibleCollectionId, newReFungibleTokenId, 100);301 await transferFromExpectFail(reFungibleCollectionId, newReFungibleTokenId, Bob, Alice, Charlie, 1);301 await transferFromExpectFail(reFungibleCollectionId, newReFungibleTokenId, Bob, Alice, Charlie, 1);302 302303 });303 });