difftreelog
Tests fix + global folders mask in config
in: master
2 files changed
tests/package.jsondiffbeforeafterboth--- a/tests/package.json
+++ b/tests/package.json
@@ -23,7 +23,7 @@
"scripts": {
"lint": "eslint --ext .ts,.js src/",
"fix": "eslint --ext .ts,.js src/ --fix",
- "test": "mocha --timeout 9999999 -r ts-node/register ./**/*.test.ts ./**/eth/**/*.test.ts",
+ "test": "mocha --timeout 9999999 -r ts-node/register './**/*.test.ts'",
"testEth": "mocha --timeout 9999999 -r ts-node/register ./**/eth/**/*.test.ts",
"load": "mocha --timeout 9999999 -r ts-node/register ./**/*.load.ts",
"loadTransfer": "ts-node src/transfer.nload.ts",
tests/src/eth/crossTransfer.test.tsdiffbeforeafterboth1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import privateKey from '../substrate/privateKey';7import { createCollectionExpectSuccess, 8 createFungibleItemExpectSuccess, 9 transferExpectSuccess, 10 transferFromExpectSuccess, 11 CrossAccountId,12 createItemExpectSuccess,13 normalizeAccountId } from '../util/helpers';14import { collectionIdToAddress, 15 createEthAccountWithBalance, 16 GAS_ARGS, itWeb3 } from './util/helpers';17import fungibleAbi from './fungibleAbi.json';18import nonFungibleAbi from './nonFungibleAbi.json';1920describe('Token transfer between substrate address and EVM address. Fungible', () => {21 itWeb3('The private key X create a substrate address. Alice sends a token to the corresponding EVM address, and X can send it to Bob in the substrate', async () => {22 const collection = await createCollectionExpectSuccess({23 name: 'token name',24 mode: { type: 'Fungible', decimalPoints: 0 },25 });26 const alice = privateKey('//Alice');27 const bob = privateKey('//Bob');28 const charlie = privateKey('//Charlie');29 const ethAccountVariant: CrossAccountId = normalizeAccountId(charlie.address);30 await createFungibleItemExpectSuccess(alice, collection, { Value: 200n }, { substrate: alice.address });31 await transferExpectSuccess(collection, 0, alice, ethAccountVariant , 200, 'Fungible');32 await transferExpectSuccess(collection, 0, charlie, bob , 200, 'Fungible');33 });3435 itWeb3('The private key X create a EVM address. Alice sends a token to the substrate address corresponding to this EVM address, and X can send it to Bob in the EVM', async ({ api, web3 }) => {36 const collection = await createCollectionExpectSuccess({37 name: 'token name',38 mode: { type: 'Fungible', decimalPoints: 0 },39 });40 const alice = privateKey('//Alice');41 const bob = privateKey('//Bob');42 const bobProxy = await createEthAccountWithBalance(api, web3);43 const aliceProxy = await createEthAccountWithBalance(api, web3);4445 await createFungibleItemExpectSuccess(alice, collection, { Value: 200n }, alice.address);46 await transferExpectSuccess(collection, 0, alice, { ethereum: aliceProxy } , 200, 'Fungible');47 const address = collectionIdToAddress(collection);48 const contract = new web3.eth.Contract(fungibleAbi as any, address, {from: aliceProxy, ...GAS_ARGS});4950 await contract.methods.transfer(bobProxy, 50).send({ from: aliceProxy });51 await transferFromExpectSuccess(collection, 0, alice, {ethereum: bobProxy}, bob, 50, 'Fungible');52 await transferExpectSuccess(collection, 0, bob, alice, 50, 'Fungible');53 });54});5556describe.only('Token transfer between substrate address and EVM address. NFT', () => {57 itWeb3.skip('The private key X create a substrate address. Alice sends a token to the corresponding EVM address, and X can send it to Bob in the substrate', async () => {58 const collection = await createCollectionExpectSuccess({59 name: 'token name',60 mode: { type: 'NFT' },61 });62 const alice = privateKey('//Alice');63 const bob = privateKey('//Bob');64 const charlie = privateKey('//Charlie');65 const ethAccountVariant: CrossAccountId = normalizeAccountId(charlie.address);66 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', { substrate: alice.address });67 await transferExpectSuccess(collection, tokenId, alice, ethAccountVariant, 1, 'NFT');68 await transferExpectSuccess(collection, tokenId, charlie, bob, 1, 'NFT');69 });7071 itWeb3('The private key X create a EVM address. Alice sends a token to the substrate address corresponding to this EVM address, and X can send it to Bob in the EVM', async ({ api, web3 }) => {72 const collection = await createCollectionExpectSuccess({73 name: 'token name',74 mode: { type: 'NFT' },75 });76 const alice = privateKey('//Alice');77 const bob = privateKey('//Bob');78 const charlie = privateKey('//Charlie');79 const bobProxy = await createEthAccountWithBalance(api, web3);80 const aliceProxy = await createEthAccountWithBalance(api, web3);81 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', { substrate: alice.address });82 await transferExpectSuccess(collection, tokenId, alice, { ethereum: aliceProxy } , 1, 'NFT');83 const address = collectionIdToAddress(collection);84 const contract = new web3.eth.Contract(nonFungibleAbi as any, address, {from: aliceProxy, ...GAS_ARGS});85 await contract.methods.transfer(bobProxy, 1).send({ from: aliceProxy });86 await transferFromExpectSuccess(collection, tokenId, alice, {ethereum: bobProxy}, bob, 1, 'NFT');87 await transferExpectSuccess(collection, tokenId, bob, charlie, 1, 'NFT');88 });89});1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import privateKey from '../substrate/privateKey';7import { createCollectionExpectSuccess, 8 createFungibleItemExpectSuccess, 9 transferExpectSuccess, 10 transferFromExpectSuccess, 11 createItemExpectSuccess } from '../util/helpers';12import { collectionIdToAddress, 13 createEthAccountWithBalance, 14 subToEth,15 GAS_ARGS, itWeb3 } from './util/helpers';16import fungibleAbi from './fungibleAbi.json';17import nonFungibleAbi from './nonFungibleAbi.json';1819describe('Token transfer between substrate address and EVM address. Fungible', () => {20 itWeb3('The private key X create a substrate address. Alice sends a token to the corresponding EVM address, and X can send it to Bob in the substrate', async () => {21 const collection = await createCollectionExpectSuccess({22 name: 'token name',23 mode: { type: 'Fungible', decimalPoints: 0 },24 });25 const alice = privateKey('//Alice');26 const bob = privateKey('//Bob');27 const charlie = privateKey('//Charlie');28 await createFungibleItemExpectSuccess(alice, collection, { Value: 200n }, { substrate: alice.address });29 await transferExpectSuccess(collection, 0, alice, {ethereum: subToEth(charlie.address)} , 200, 'Fungible');30 await transferFromExpectSuccess(collection, 0, alice, {ethereum: subToEth(charlie.address)}, charlie, 50, 'Fungible');31 await transferExpectSuccess(collection, 0, charlie, bob, 50, 'Fungible');32 });3334 itWeb3('The private key X create a EVM address. Alice sends a token to the substrate address corresponding to this EVM address, and X can send it to Bob in the EVM', async ({ api, web3 }) => {35 const collection = await createCollectionExpectSuccess({36 name: 'token name',37 mode: { type: 'Fungible', decimalPoints: 0 },38 });39 const alice = privateKey('//Alice');40 const bob = privateKey('//Bob');41 const bobProxy = await createEthAccountWithBalance(api, web3);42 const aliceProxy = await createEthAccountWithBalance(api, web3);4344 await createFungibleItemExpectSuccess(alice, collection, { Value: 200n }, alice.address);45 await transferExpectSuccess(collection, 0, alice, { ethereum: aliceProxy } , 200, 'Fungible');46 const address = collectionIdToAddress(collection);47 const contract = new web3.eth.Contract(fungibleAbi as any, address, {from: aliceProxy, ...GAS_ARGS});4849 await contract.methods.transfer(bobProxy, 50).send({ from: aliceProxy });50 await transferFromExpectSuccess(collection, 0, alice, {ethereum: bobProxy}, bob, 50, 'Fungible');51 await transferExpectSuccess(collection, 0, bob, alice, 50, 'Fungible');52 });53});5455describe.only('Token transfer between substrate address and EVM address. NFT', () => {56 itWeb3('The private key X create a substrate address. Alice sends a token to the corresponding EVM address, and X can send it to Bob in the substrate', async () => {57 const collection = await createCollectionExpectSuccess({58 name: 'token name',59 mode: { type: 'NFT' },60 });61 const alice = privateKey('//Alice');62 const bob = privateKey('//Bob');63 const charlie = privateKey('//Charlie');64 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', { substrate: alice.address });65 await transferExpectSuccess(collection, tokenId, alice, { ethereum: subToEth(charlie.address) }, 1, 'NFT');66 await transferFromExpectSuccess(collection, tokenId, alice, {ethereum: subToEth(charlie.address)}, charlie, 1, 'NFT');67 await transferExpectSuccess(collection, tokenId, charlie, bob, 1, 'NFT');68 });6970 itWeb3('The private key X create a EVM address. Alice sends a token to the substrate address corresponding to this EVM address, and X can send it to Bob in the EVM', async ({ api, web3 }) => {71 const collection = await createCollectionExpectSuccess({72 name: 'token name',73 mode: { type: 'NFT' },74 });75 const alice = privateKey('//Alice');76 const bob = privateKey('//Bob');77 const charlie = privateKey('//Charlie');78 const bobProxy = await createEthAccountWithBalance(api, web3);79 const aliceProxy = await createEthAccountWithBalance(api, web3);80 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', { substrate: alice.address });81 await transferExpectSuccess(collection, tokenId, alice, { ethereum: aliceProxy } , 1, 'NFT');82 const address = collectionIdToAddress(collection);83 const contract = new web3.eth.Contract(nonFungibleAbi as any, address, {from: aliceProxy, ...GAS_ARGS});84 await contract.methods.transfer(bobProxy, 1).send({ from: aliceProxy });85 await transferFromExpectSuccess(collection, tokenId, alice, {ethereum: bobProxy}, bob, 1, 'NFT');86 await transferExpectSuccess(collection, tokenId, bob, charlie, 1, 'NFT');87 });88});