difftreelog
fix test after burtItem redesign (partially)
in: master
7 files changed
tests/src/burnItem.test.tsdiffbeforeafterboth38 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);38 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);393940 await usingApi(async (api) => {40 await usingApi(async (api) => {41 const tx = api.tx.nft.burnItem(collectionId, tokenId, normalizeAccountId(alice.address), 0);41 const tx = api.tx.nft.burnItem(collectionId, tokenId, 0);42 const events = await submitTransactionAsync(alice, tx);42 const events = await submitTransactionAsync(alice, tx);43 const result = getGenericResult(events);43 const result = getGenericResult(events);44 // Get the item44 // Get the item595960 await usingApi(async (api) => {60 await usingApi(async (api) => {61 // Destroy 1 of 1061 // Destroy 1 of 1062 const tx = api.tx.nft.burnItem(collectionId, tokenId, normalizeAccountId(alice.address), 1);62 const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);63 const events = await submitTransactionAsync(alice, tx);63 const events = await submitTransactionAsync(alice, tx);64 const result = getGenericResult(events);64 const result = getGenericResult(events);65 65 79 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);79 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);808081 await usingApi(async (api) => {81 await usingApi(async (api) => {82 const tx = api.tx.nft.burnItem(collectionId, tokenId, normalizeAccountId(alice.address), 1);82 const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);83 const events = await submitTransactionAsync(alice, tx);83 const events = await submitTransactionAsync(alice, tx);84 const result = getGenericResult(events);84 const result = getGenericResult(events);85 85 92 });92 });93 });93 });949495 it('Burn owned portion of item in ReFungible collection', async () => {95 it.only('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, normalizeAccountId(bob.address), 0);110 const tx = api.tx.nft.burnItem(collectionId, tokenId, 0);111 const events2 = await submitTransactionAsync(bob, tx);111 const events2 = await submitTransactionAsync(bob, tx);112 const result2 = getGenericResult(events2);112 const result2 = getGenericResult(events2);113113152 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, normalizeAccountId(alice.address), 0);155 const tx = api.tx.nft.burnItem(collectionId, tokenId, 0);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('Burn item in Fungible collection', async () => {169 it.only('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 tokens175175176 await usingApi(async (api) => {176 await usingApi(async (api) => {177 // Destroy 1 of 10177 // Destroy 1 of 10178 const tx = api.tx.nft.burnItem(collectionId, tokenId, normalizeAccountId(alice.address), 1);178 const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);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 189 });189 });190 });190 });191 191 192 it('Burn item in ReFungible collection', async () => {192 it.only('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, normalizeAccountId(alice.address), 1);199 const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);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 225 await destroyCollectionExpectSuccess(collectionId);225 await destroyCollectionExpectSuccess(collectionId);226226227 await usingApi(async (api) => {227 await usingApi(async (api) => {228 const tx = api.tx.nft.burnItem(collectionId, tokenId, normalizeAccountId(alice.address), 0);228 const tx = api.tx.nft.burnItem(collectionId, tokenId, 0);229 const badTransaction = async function () { 229 const badTransaction = async function () { 230 await submitTransactionExpectFailAsync(alice, tx);230 await submitTransactionExpectFailAsync(alice, tx);231 };231 };240 const tokenId = 10;240 const tokenId = 10;241241242 await usingApi(async (api) => {242 await usingApi(async (api) => {243 const tx = api.tx.nft.burnItem(collectionId, tokenId, normalizeAccountId(alice.address), 0);243 const tx = api.tx.nft.burnItem(collectionId, tokenId, 0);244 const badTransaction = async function () { 244 const badTransaction = async function () { 245 await submitTransactionExpectFailAsync(alice, tx);245 await submitTransactionExpectFailAsync(alice, tx);246 };246 };255 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);255 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);256256257 await usingApi(async (api) => {257 await usingApi(async (api) => {258 const tx = api.tx.nft.burnItem(collectionId, tokenId, normalizeAccountId(alice.address), 0);258 const tx = api.tx.nft.burnItem(collectionId, tokenId, 0);259 const badTransaction = async function () { 259 const badTransaction = async function () { 260 await submitTransactionExpectFailAsync(bob, tx);260 await submitTransactionExpectFailAsync(bob, tx);261 };261 };271271272 await usingApi(async (api) => {272 await usingApi(async (api) => {273273274 const burntx = api.tx.nft.burnItem(collectionId, tokenId, normalizeAccountId(alice.address), 0);274 const burntx = api.tx.nft.burnItem(collectionId, tokenId, 0);275 const events1 = await submitTransactionAsync(alice, burntx);275 const events1 = await submitTransactionAsync(alice, burntx);276 const result1 = getGenericResult(events1);276 const result1 = getGenericResult(events1);277 expect(result1.success).to.be.true;277 expect(result1.success).to.be.true;294294295 await usingApi(async (api) => {295 await usingApi(async (api) => {296 // Destroy 11 of 10296 // Destroy 11 of 10297 const tx = api.tx.nft.burnItem(collectionId, tokenId, normalizeAccountId(alice.address), 11);297 const tx = api.tx.nft.burnItem(collectionId, tokenId, 11);298 const badTransaction = async function () { 298 const badTransaction = async function () { 299 await submitTransactionExpectFailAsync(alice, tx);299 await submitTransactionExpectFailAsync(alice, tx);300 };300 };tests/src/check-event/burnItemEvent.test.tsdiffbeforeafterboth--- a/tests/src/check-event/burnItemEvent.test.ts
+++ b/tests/src/check-event/burnItemEvent.test.ts
@@ -29,7 +29,7 @@
await usingApi(async (api: ApiPromise) => {
const collectionID = await createCollectionExpectSuccess();
const itemID = await createItemExpectSuccess(Alice, collectionID, 'NFT');
- const burnItem = api.tx.nft.burnItem(collectionID, itemID, normalizeAccountId(Alice.address), 1);
+ const burnItem = api.tx.nft.burnItem(collectionID, itemID, 1);
const events = await submitTransactionAsync(Alice, burnItem);
const msg = JSON.stringify(nftEventMessage(events));
expect(msg).to.be.contain(checkSection);
tests/src/collision-tests/admVsOwnerTake.test.tsdiffbeforeafterboth--- a/tests/src/collision-tests/admVsOwnerTake.test.ts
+++ b/tests/src/collision-tests/admVsOwnerTake.test.ts
@@ -34,7 +34,7 @@
const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');
//
const sendItem = api.tx.nft.transfer(normalizeAccountId(Ferdie.address), collectionId, itemId, 1);
- const burnItem = api.tx.nft.burnItem(collectionId, itemId, normalizeAccountId(Alice.address), 1);
+ const burnItem = api.tx.nft.burnItem(collectionId, itemId, 1);
await Promise.all([
sendItem.signAndSend(Bob),
burnItem.signAndSend(Alice),
tests/src/setVariableMetaData.test.tsdiffbeforeafterboth--- a/tests/src/setVariableMetaData.test.ts
+++ b/tests/src/setVariableMetaData.test.ts
@@ -116,7 +116,7 @@
it('fails on removed token', async () => {
const removedTokenCollectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });
const removedTokenId = await createItemExpectSuccess(alice, removedTokenCollectionId, 'NFT');
- await burnItemExpectSuccess(alice, removedTokenCollectionId, removedTokenId, alice);
+ await burnItemExpectSuccess(alice, removedTokenCollectionId, removedTokenId);
await setVariableMetaDataExpectFailure(alice, removedTokenCollectionId, removedTokenId, data);
});
tests/src/transfer.test.tsdiffbeforeafterboth--- a/tests/src/transfer.test.ts
+++ b/tests/src/transfer.test.ts
@@ -184,22 +184,22 @@
1,
);
});
- it('Transfer with deleted item_id', async () => {
+ it.only('Transfer with deleted item_id', async () => {
// nft
const nftCollectionId = await createCollectionExpectSuccess();
const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');
- await burnItemExpectSuccess(Alice, nftCollectionId, newNftTokenId, Alice, 1);
+ await burnItemExpectSuccess(Alice, nftCollectionId, newNftTokenId, 1);
await transferExpectFailure(nftCollectionId, newNftTokenId, Alice, Bob, 1);
// fungible
const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
const newFungibleTokenId = await createItemExpectSuccess(Alice, fungibleCollectionId, 'Fungible');
- await burnItemExpectSuccess(Alice, fungibleCollectionId, newFungibleTokenId, Alice, 10);
+ await burnItemExpectSuccess(Alice, fungibleCollectionId, newFungibleTokenId, 10);
await transferExpectFailure(fungibleCollectionId, newFungibleTokenId, Alice, Bob, 1);
// reFungible
const reFungibleCollectionId = await
createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');
- await burnItemExpectSuccess(Alice, reFungibleCollectionId, newReFungibleTokenId, Alice, 1);
+ await burnItemExpectSuccess(Alice, reFungibleCollectionId, newReFungibleTokenId, 1);
await transferExpectFailure(
reFungibleCollectionId,
newReFungibleTokenId,
tests/src/transferFrom.test.tsdiffbeforeafterboth--- a/tests/src/transferFrom.test.ts
+++ b/tests/src/transferFrom.test.ts
@@ -246,16 +246,16 @@
// nft
const nftCollectionId = await createCollectionExpectSuccess();
const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');
- await burnItemExpectSuccess(Alice, nftCollectionId, newNftTokenId, Alice, 1);
+ await burnItemExpectSuccess(Alice, nftCollectionId, newNftTokenId, 1);
await approveExpectFail(nftCollectionId, newNftTokenId, Alice, Bob);
await transferFromExpectFail(nftCollectionId, newNftTokenId, Bob, Alice, Charlie, 1);
});
});
- it( 'transferFrom burnt token before approve Fungible', async () => {
+ it.only( '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, Alice, 10);
+ await burnItemExpectSuccess(Alice, fungibleCollectionId, 1, 10);
await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, Alice, Bob);
await transferFromExpectFail(fungibleCollectionId, newFungibleTokenId, Bob, Alice, Charlie, 1);
@@ -265,39 +265,39 @@
await usingApi(async () => {
const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
const newReFungibleTokenId = await createItemExpectSuccess(Alice, reFungibleCollectionId, 'ReFungible');
- await burnItemExpectSuccess(Alice, reFungibleCollectionId, newReFungibleTokenId, Alice, 1);
+ await burnItemExpectSuccess(Alice, reFungibleCollectionId, newReFungibleTokenId, 1);
await approveExpectFail(reFungibleCollectionId, newReFungibleTokenId, Alice, Bob);
await transferFromExpectFail(reFungibleCollectionId, newReFungibleTokenId, Bob, Alice, Charlie, 1);
});
});
- it( 'transferFrom burnt token after approve NFT', async () => {
+ it.only( '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, Alice, 1);
+ await burnItemExpectSuccess(Alice, nftCollectionId, newNftTokenId, 1);
await transferFromExpectFail(nftCollectionId, newNftTokenId, Bob, Alice, Charlie, 1);
});
});
- it( 'transferFrom burnt token after approve Fungible', async () => {
+ it.only( '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, Alice, 10);
+ await burnItemExpectSuccess(Alice, fungibleCollectionId, 1, 10);
await transferFromExpectFail(fungibleCollectionId, newFungibleTokenId, Bob, Alice, Charlie, 1);
});
});
- it( 'transferFrom burnt token after approve ReFungible', async () => {
+ it.only( '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, Alice, 1);
+ await burnItemExpectSuccess(Alice, reFungibleCollectionId, newReFungibleTokenId, 1);
await transferFromExpectFail(reFungibleCollectionId, newReFungibleTokenId, Bob, Alice, Charlie, 1);
});
tests/src/util/helpers.tsdiffbeforeafterboth--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -700,9 +700,9 @@
ReFungible: CreateReFungibleData;
};
-export async function burnItemExpectSuccess(sender: IKeyringPair, collectionId: number, tokenId: number, owner: IKeyringPair, value = 0) {
+export async function burnItemExpectSuccess(sender: IKeyringPair, collectionId: number, tokenId: number, value = 0) {
await usingApi(async (api) => {
- const tx = api.tx.nft.burnItem(collectionId, tokenId, normalizeAccountId(owner.address), value);
+ const tx = api.tx.nft.burnItem(collectionId, tokenId, value);
const events = await submitTransactionAsync(sender, tx);
const result = getGenericResult(events);
// Get the item