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

difftreelog

CORE-215 Add test Transfers to self. In case of inside substrate-evm Transfers to self. In case of inside substrate-evm when not enought "Fungibles"

Trubnikov Sergey2022-02-22parent: #e6f8932.patch.diff
in: master

1 file changed

modifiedtests/src/transfer.test.tsdiffbeforeafterboth
25 normalizeAccountId,25 normalizeAccountId,
26 getBalance as getTokenBalance,26 getBalance as getTokenBalance,
27 transferFromExpectSuccess,27 transferFromExpectSuccess,
28 transferFromExpectFail,
28} from './util/helpers';29} from './util/helpers';
29import {30import {
30 subToEth,31 subToEth,
299 });300 });
300});301});
301302
302describe.only('Transfers to self (potentially over substrate-evm boundary)', () => {303describe('Transfers to self (potentially over substrate-evm boundary)', () => {
303 itWeb3('Transfers to self. In case of same frontend', async ({api}) => {304 itWeb3('Transfers to self. In case of same frontend', async ({api}) => {
304 const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});305 const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
305 const alice = privateKey('//Alice');306 const alice = privateKey('//Alice');
324 expect(balanceAliceBefore).to.be.eq(balanceAliceAfter);325 expect(balanceAliceBefore).to.be.eq(balanceAliceAfter);
325 });326 });
327
328 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, 'ReFungible');
334 await transferFromExpectSuccess(collectionId, tokenId, alice, alice, alice, 10, 'ReFungible');
335 const balanceAliceAfter = await getTokenBalance(api, collectionId, normalizeAccountId(alice), tokenId);
336 expect(balanceAliceBefore).to.be.eq(balanceAliceAfter);
337 });
338
339 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 });
326});349});
327350