difftreelog
test fix burnFrom tests
in: master
2 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, 0);41 const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);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 item79 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, 1);82 const tx = api.tx.nft.burnItem(collectionId, tokenId, 100);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 166 });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 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode); // Helper creates 10 fungible tokens173 await addCollectionAdminExpectSuccess(alice, collectionId, bob);173 await addCollectionAdminExpectSuccess(alice, collectionId, bob);174 const tokenId = 0; // ignored175174176 await usingApi(async (api) => {175 await usingApi(async (api) => {177 // Destroy 1 of 10176 // Destroy 1 of 10178 const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);177 const tx = api.tx.nft.burnFrom(collectionId, alice.address, tokenId, 1);179 const events = await submitTransactionAsync(bob, tx);178 const events = await submitTransactionAsync(bob, tx);180 const result = getGenericResult(events);179 const result = getGenericResult(events);181180189 });188 });190 });189 });191190192 it('Burn item in ReFungible collection', async () => {191 it.only('Burn item in ReFungible collection', async () => {193 const createMode = 'ReFungible';192 const createMode = 'ReFungible';194 const collectionId = await createCollectionExpectSuccess({mode: {type: createMode }});193 const collectionId = await createCollectionExpectSuccess({mode: {type: createMode }});195 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);194 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);196 await addCollectionAdminExpectSuccess(alice, collectionId, bob);195 await addCollectionAdminExpectSuccess(alice, collectionId, bob);197196198 await usingApi(async (api) => {197 await usingApi(async (api) => {199 const tx = api.tx.nft.burnItem(collectionId, tokenId, 100);198 const tx = api.tx.nft.burnFrom(collectionId, alice.address, tokenId, 100);200 const events = await submitTransactionAsync(bob, tx);199 const events = await submitTransactionAsync(bob, tx);201 const result = getGenericResult(events);200 const result = getGenericResult(events);202 // Get alice balance201 // Get alice balancetests/src/util/helpers.tsdiffbeforeafterboth700 ReFungible: CreateReFungibleData;700 ReFungible: CreateReFungibleData;701};701};702702703export async function burnItemExpectSuccess(sender: IKeyringPair, collectionId: number, tokenId: number, value = 0) {703export async function burnItemExpectSuccess(sender: IKeyringPair, collectionId: number, tokenId: number, value = 1) {704 await usingApi(async (api) => {704 await usingApi(async (api) => {705 const tx = api.tx.nft.burnItem(collectionId, tokenId, value);705 const tx = api.tx.nft.burnItem(collectionId, tokenId, value);706 const events = await submitTransactionAsync(sender, tx);706 const events = await submitTransactionAsync(sender, tx);