difftreelog
test (confirmSponsorship): test CORE-239, make sure sponsor doesn't cover transfer fees for failed transactions
in: master
1 file changed
tests/src/confirmSponsorship.test.tsdiffbeforeafterboth373 await confirmSponsorshipExpectFailure(collectionId, '//Bob');373 await confirmSponsorshipExpectFailure(collectionId, '//Bob');374 });374 });375376 it('(!negative test!) Transfer fees are not paid by the sponsor if the transfer failed', async () => {377 const collectionId = await createCollectionExpectSuccess();378 await setCollectionSponsorExpectSuccess(collectionId, bob.address);379 await confirmSponsorshipExpectSuccess(collectionId, '//Bob');380381 await usingApi(async (api) => {382 // Find unused address383 const ownerZeroBalance = await findUnusedAddress(api);384385 // Find another unused address386 const senderZeroBalance = await findUnusedAddress(api);387388 // Mint token for an unused address389 const itemId = await createItemExpectSuccess(alice, collectionId, 'NFT', ownerZeroBalance.address);390391 const sponsorBalanceBeforeTx = (await api.query.system.account(bob.address)).data.free.toBigInt();392393 // Try to transfer this token from an unsponsored unused adress to Alice394 const zeroToAlice = api.tx.unique.transfer(normalizeAccountId(alice.address), collectionId, itemId, 0);395 await expect(submitTransactionExpectFailAsync(senderZeroBalance, zeroToAlice)).to.be.rejected;396397 const sponsorBalanceAfterTx = (await api.query.system.account(bob.address)).data.free.toBigInt();398399 expect(sponsorBalanceAfterTx).to.equal(sponsorBalanceBeforeTx);400 });401 });375});402});376403