From f663e99db82180e12c3caf6ee626c4b8e2e7fc39 Mon Sep 17 00:00:00 2001 From: kozyrevdev <73348153+kozyrevdev@users.noreply.github.com> Date: Thu, 17 Feb 2022 07:36:42 +0000 Subject: [PATCH] Merge pull request #262 from UniqueNetwork/feature/CORE-259 Integration test (confirmSponsorship): CORE-239 --- --- a/tests/src/confirmSponsorship.test.ts +++ b/tests/src/confirmSponsorship.test.ts @@ -373,4 +373,31 @@ await destroyCollectionExpectSuccess(collectionId); await confirmSponsorshipExpectFailure(collectionId, '//Bob'); }); + + it('(!negative test!) Transfer fees are not paid by the sponsor if the transfer failed', async () => { + const collectionId = await createCollectionExpectSuccess(); + await setCollectionSponsorExpectSuccess(collectionId, bob.address); + await confirmSponsorshipExpectSuccess(collectionId, '//Bob'); + + await usingApi(async (api) => { + // Find unused address + const ownerZeroBalance = await findUnusedAddress(api); + + // Find another unused address + const senderZeroBalance = await findUnusedAddress(api); + + // Mint token for an unused address + const itemId = await createItemExpectSuccess(alice, collectionId, 'NFT', ownerZeroBalance.address); + + const sponsorBalanceBeforeTx = (await api.query.system.account(bob.address)).data.free.toBigInt(); + + // Try to transfer this token from an unsponsored unused adress to Alice + const zeroToAlice = api.tx.unique.transfer(normalizeAccountId(alice.address), collectionId, itemId, 0); + await expect(submitTransactionExpectFailAsync(senderZeroBalance, zeroToAlice)).to.be.rejected; + + const sponsorBalanceAfterTx = (await api.query.system.account(bob.address)).data.free.toBigInt(); + + expect(sponsorBalanceAfterTx).to.equal(sponsorBalanceBeforeTx); + }); + }); }); -- gitstuff