difftreelog
CORE-215 Fix helpers: check same sender and recepient
in: master
2 files changed
tests/src/transfer.test.tsdiffbeforeafterboth325 expect(balanceAliceBefore).to.be.eq(balanceAliceAfter);325 expect(balanceAliceBefore).to.be.eq(balanceAliceAfter);326 });326 });327327328 itWeb3.only('Transfers to self. In case of inside substrate-evm', async ({api}) => {328 itWeb3('Transfers to self. In case of inside substrate-evm', async ({api}) => {329 const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});329 const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});330 const alice = privateKey('//Alice');330 const alice = privateKey('//Alice');331 const tokenId = await createItemExpectSuccess(alice, collectionId, 'Fungible', {Substrate: alice.address});331 const tokenId = await createItemExpectSuccess(alice, collectionId, 'Fungible', {Substrate: alice.address});tests/src/util/helpers.tsdiffbeforeafterboth752 type = 'NFT',753 type = 'NFT',753) {754) {754 await usingApi(async (api: ApiPromise) => {755 await usingApi(async (api: ApiPromise) => {756 const from = normalizeAccountId(accountFrom);755 const to = normalizeAccountId(accountTo);757 const to = normalizeAccountId(accountTo);756 let balanceBefore = 0n;758 let balanceBefore = 0n;757 if (type === 'Fungible') {759 if (type === 'Fungible') {767 }769 }768 if (type === 'Fungible') {770 if (type === 'Fungible') {769 const balanceAfter = await getBalance(api, collectionId, to, tokenId);771 const balanceAfter = await getBalance(api, collectionId, to, tokenId);772 if (JSON.stringify(to) !== JSON.stringify(from)) {770 expect(balanceAfter - balanceBefore).to.be.equal(BigInt(value));773 expect(balanceAfter - balanceBefore).to.be.equal(BigInt(value));774 } else {775 expect(balanceAfter).to.be.equal(balanceBefore);776 }771 }777 }772 if (type === 'ReFungible') {778 if (type === 'ReFungible') {773 expect(await getBalance(api, collectionId, to, tokenId)).to.be.equal(BigInt(value));779 expect(await getBalance(api, collectionId, to, tokenId)).to.be.equal(BigInt(value));866 type = 'NFT',872 type = 'NFT',867) {873) {868 await usingApi(async (api: ApiPromise) => {874 await usingApi(async (api: ApiPromise) => {875 const from = normalizeAccountId(sender);869 const to = normalizeAccountId(recipient);876 const to = normalizeAccountId(recipient);870877871 let balanceBefore = 0n;878 let balanceBefore = 0n;887 }894 }888 if (type === 'Fungible') {895 if (type === 'Fungible') {889 const balanceAfter = await getBalance(api, collectionId, to, tokenId);896 const balanceAfter = await getBalance(api, collectionId, to, tokenId);897 if (JSON.stringify(to) !== JSON.stringify(from)) {890 expect(balanceAfter - balanceBefore).to.be.equal(BigInt(value));898 expect(balanceAfter - balanceBefore).to.be.equal(BigInt(value));899 } else {900 expect(balanceAfter).to.be.equal(balanceBefore);901 }891 }902 }892 if (type === 'ReFungible') {903 if (type === 'ReFungible') {893 expect(await getBalance(api, collectionId, to, tokenId) >= value).to.be.true;904 expect(await getBalance(api, collectionId, to, tokenId) >= value).to.be.true;