difftreelog
Merge pull request #249 from UniqueNetwork/feature/CORE-215
in: master
CORE-215
1 file changed
tests/src/transfer.test.tsdiffbeforeafterboth24 getTokenOwner,24 getTokenOwner,25 normalizeAccountId,25 normalizeAccountId,26 getBalance as getTokenBalance,26 getBalance as getTokenBalance,27 transferFromExpectSuccess,28 transferFromExpectFail,27} from './util/helpers';29} from './util/helpers';30import {31 subToEth,32 itWeb3, 33} from './eth/util/helpers';283429let alice: IKeyringPair;35let alice: IKeyringPair;30let bob: IKeyringPair;36let bob: IKeyringPair;294 });300 });295});301});302303describe('Transfers to self (potentially over substrate-evm boundary)', () => {304 itWeb3('Transfers to self. In case of same frontend', async ({api}) => {305 const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});306 const alice = privateKey('//Alice');307 const aliceProxy = subToEth(alice.address);308 const tokenId = await createItemExpectSuccess(alice, collectionId, 'Fungible', {Substrate: alice.address});309 await transferExpectSuccess(collectionId, tokenId, alice, {Ethereum: aliceProxy}, 10, 'Fungible');310 const balanceAliceBefore = await getTokenBalance(api, collectionId, {Ethereum: aliceProxy}, tokenId);311 await transferFromExpectSuccess(collectionId, tokenId, alice, {Ethereum: aliceProxy}, {Ethereum: aliceProxy}, 10, 'Fungible');312 const balanceAliceAfter = await getTokenBalance(api, collectionId, {Ethereum: aliceProxy}, tokenId);313 expect(balanceAliceBefore).to.be.eq(balanceAliceAfter);314 });315316 itWeb3('Transfers to self. In case of substrate-evm boundary', async ({api}) => {317 const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});318 const alice = privateKey('//Alice');319 const aliceProxy = subToEth(alice.address);320 const tokenId = await createItemExpectSuccess(alice, collectionId, 'Fungible', {Substrate: alice.address});321 const balanceAliceBefore = await getTokenBalance(api, collectionId, normalizeAccountId(alice), tokenId);322 await transferExpectSuccess(collectionId, tokenId, alice, {Ethereum: aliceProxy} , 10, 'Fungible');323 await transferFromExpectSuccess(collectionId, tokenId, alice, {Ethereum: aliceProxy}, alice, 10, 'Fungible');324 const balanceAliceAfter = await getTokenBalance(api, collectionId, normalizeAccountId(alice), tokenId);325 expect(balanceAliceBefore).to.be.eq(balanceAliceAfter);326 });327328 itWeb3.only('Transfers to self. In case of inside substrate-evm', async ({api}) => {329 const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});330 const alice = privateKey('//Alice');331 const tokenId = await createItemExpectSuccess(alice, collectionId, 'Fungible', {Substrate: alice.address});332 const balanceAliceBefore = await getTokenBalance(api, collectionId, normalizeAccountId(alice), tokenId);333 await transferExpectSuccess(collectionId, tokenId, alice, alice , 10, 'Fungible');334 await transferFromExpectSuccess(collectionId, tokenId, alice, alice, alice, 10, 'Fungible');335 const balanceAliceAfter = await getTokenBalance(api, collectionId, normalizeAccountId(alice), tokenId);336 expect(balanceAliceBefore).to.be.eq(balanceAliceAfter);337 });338339 itWeb3('Transfers to self. In case of inside substrate-evm when not enought "Fungibles"', async ({api}) => {340 const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});341 const alice = privateKey('//Alice');342 const tokenId = await createItemExpectSuccess(alice, collectionId, 'Fungible', {Substrate: alice.address});343 const balanceAliceBefore = await getTokenBalance(api, collectionId, normalizeAccountId(alice), tokenId);344 await transferExpectFailure(collectionId, tokenId, alice, alice , 11);345 await transferFromExpectFail(collectionId, tokenId, alice, alice, alice, 11);346 const balanceAliceAfter = await getTokenBalance(api, collectionId, normalizeAccountId(alice), tokenId);347 expect(balanceAliceBefore).to.be.eq(balanceAliceAfter);348 });349});350