git.delta.rocks / unique-network / refs/commits / f663e99db821

difftreelog

Merge pull request #262 from UniqueNetwork/feature/CORE-259

kozyrevdev2022-02-17parents: #6ed3d50 #e8c60d0.patch.diff
in: master
Integration test (confirmSponsorship): CORE-239

1 file changed

modifiedtests/src/confirmSponsorship.test.tsdiffbeforeafterboth
374 await confirmSponsorshipExpectFailure(collectionId, '//Bob');374 await confirmSponsorshipExpectFailure(collectionId, '//Bob');
375 });375 });
376
377 it('(!negative test!) Transfer fees are not paid by the sponsor if the transfer failed', async () => {
378 const collectionId = await createCollectionExpectSuccess();
379 await setCollectionSponsorExpectSuccess(collectionId, bob.address);
380 await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
381
382 await usingApi(async (api) => {
383 // Find unused address
384 const ownerZeroBalance = await findUnusedAddress(api);
385
386 // Find another unused address
387 const senderZeroBalance = await findUnusedAddress(api);
388
389 // Mint token for an unused address
390 const itemId = await createItemExpectSuccess(alice, collectionId, 'NFT', ownerZeroBalance.address);
391
392 const sponsorBalanceBeforeTx = (await api.query.system.account(bob.address)).data.free.toBigInt();
393
394 // Try to transfer this token from an unsponsored unused adress to Alice
395 const zeroToAlice = api.tx.unique.transfer(normalizeAccountId(alice.address), collectionId, itemId, 0);
396 await expect(submitTransactionExpectFailAsync(senderZeroBalance, zeroToAlice)).to.be.rejected;
397
398 const sponsorBalanceAfterTx = (await api.query.system.account(bob.address)).data.free.toBigInt();
399
400 expect(sponsorBalanceAfterTx).to.equal(sponsorBalanceBeforeTx);
401 });
402 });
376});403});
377404