difftreelog
test fix refungible test
in: master
1 file changed
tests/src/confirmSponsorship.test.tsdiffbeforeafterboth251 const zeroBalance = await findUnusedAddress(api);251 const zeroBalance = await findUnusedAddress(api);252252253 // Mint token for alice253 // Mint token for alice254 const itemId = await createItemExpectSuccess(alice, collectionId, 'ReFungible', alice.address);254 const itemId = await createItemExpectSuccess(alice, collectionId, 'ReFungible', zeroBalance.address);255255256 // Transfer this token from Alice to unused address and back257 // Alice to Zero gets sponsored258 const aliceToZero = api.tx.nft.transfer(normalizeAccountId(zeroBalance.address), collectionId, itemId, 1);256 const zeroToAlice = api.tx.nft.transfer(normalizeAccountId(alice.address), collectionId, itemId, 1);257258 // Zero to alice gets sponsored259 const events1 = await submitTransactionAsync(alice, aliceToZero);259 const events1 = await submitTransactionAsync(zeroBalance, zeroToAlice);260 const result1 = getGenericResult(events1);260 const result1 = getGenericResult(events1);261 expect(result1.success).to.be.true;261 expect(result1.success).to.be.true;262262263 // Second transfer should fail263 // Second transfer should fail264 const sponsorBalanceBefore = (await api.query.system.account(bob.address)).data.free.toBigInt();264 const sponsorBalanceBefore = (await api.query.system.account(bob.address)).data.free.toBigInt();265 const zeroToAlice = api.tx.nft.transfer(normalizeAccountId(alice.address), collectionId, itemId, 1);266 const badTransaction = async function () {267 await submitTransactionExpectFailAsync(zeroBalance, zeroToAlice);268 };269 await expect(badTransaction()).to.be.rejectedWith('Inability to pay some fees');265 await expect(submitTransactionExpectFailAsync(zeroBalance, zeroToAlice)).to.be.rejectedWith('Inability to pay some fees');270 const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();266 const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();267 expect(sponsorBalanceAfter).to.be.equal(sponsorBalanceBefore);271268272 // Try again after Zero gets some balance - now it should succeed269 // Try again after Zero gets some balance - now it should succeed273 const balancetx = api.tx.balances.transfer(zeroBalance.address, 1e15);270 const balancetx = api.tx.balances.transfer(zeroBalance.address, 1e15);276 const result2 = getGenericResult(events2);273 const result2 = getGenericResult(events2);277 expect(result2.success).to.be.true;274 expect(result2.success).to.be.true;278279 expect(sponsorBalanceAfter).to.be.equal(sponsorBalanceBefore);280 });275 });281 });276 });282277