git.delta.rocks / unique-network / refs/commits / 29762d93da0e

difftreelog

fix tests

Trubnikov Sergey2023-04-18parent: #9871bd2.patch.diff
in: master

4 files changed

modifiedtests/src/eth/fungible.test.tsdiffbeforeafterboth
431 itEth('Check balanceOfCross()', async ({helper}) => {431 itEth('Check balanceOfCross()', async ({helper}) => {
432 const collection = await helper.ft.mintCollection(alice, {});432 const collection = await helper.ft.mintCollection(alice, {});
433 const owner = await helper.ethCrossAccount.createAccountWithBalance(donor);433 const owner = await helper.ethCrossAccount.createAccountWithBalance(donor);
434 const other = await helper.ethCrossAccount.createAccountWithBalance(donor);
434 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);435 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
435 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner.eth);436 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner.eth);
436437
437 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 0n).to.be.true;438 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 0n).to.be.true;
438
439 let sum = 0n;439 expect(BigInt(await collectionEvm.methods.balanceOfCross(other).call({from: owner.eth})) === 0n).to.be.true;
440 for (let i = 1n; i < 100n; i++) {440
441 await collection.mint(alice, 100n, {Ethereum: owner.eth});441 await collection.mint(alice, 100n, {Ethereum: owner.eth});
442 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 100n).to.be.true;
443 expect(BigInt(await collectionEvm.methods.balanceOfCross(other).call({from: owner.eth})) === 0n).to.be.true;
444
445 await collectionEvm.methods.transferCross(other, 50n).send({from: owner.eth});
446 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 50n).to.be.true;
447 expect(BigInt(await collectionEvm.methods.balanceOfCross(other).call({from: owner.eth})) === 50n).to.be.true;
448
449 await collectionEvm.methods.transferCross(other, 50n).send({from: owner.eth});
450 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 0n).to.be.true;
451 expect(BigInt(await collectionEvm.methods.balanceOfCross(other).call({from: owner.eth})) === 100n).to.be.true;
452
442 sum += 100n;453 await collectionEvm.methods.transferCross(owner, 100n).send({from: other.eth});
443 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === sum).to.be.true;454 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 100n).to.be.true;
444 }455 expect(BigInt(await collectionEvm.methods.balanceOfCross(other).call({from: owner.eth})) === 0n).to.be.true;
445 });456 });
446});457});
447458
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
671671
672 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 0n).to.be.true;672 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 0n).to.be.true;
673673
674 for (let i = 1n; i < 100n; i++) {674 for (let i = 1n; i < 10n; i++) {
675 await collection.mintToken(minter, {Ethereum: owner.eth});675 await collection.mintToken(minter, {Ethereum: owner.eth});
676 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === i).to.be.true;676 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === i).to.be.true;
677 }677 }
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
593593
594 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 0n).to.be.true;594 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 0n).to.be.true;
595595
596 for (let i = 1n; i < 100n; i++) {596 for (let i = 1n; i < 10n; i++) {
597 await collection.mintToken(minter, 100n, {Ethereum: owner.eth});597 await collection.mintToken(minter, 100n, {Ethereum: owner.eth});
598 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === i).to.be.true;598 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === i).to.be.true;
599 }599 }
modifiedtests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth
470 itEth('Check balanceOfCross()', async ({helper}) => {470 itEth('Check balanceOfCross()', async ({helper}) => {
471 const collection = await helper.rft.mintCollection(alice, {});471 const collection = await helper.rft.mintCollection(alice, {});
472 const owner = await helper.ethCrossAccount.createAccountWithBalance(donor);472 const owner = await helper.ethCrossAccount.createAccountWithBalance(donor);
473 const other = await helper.ethCrossAccount.createAccountWithBalance(donor);
473 const {tokenId} = await collection.mintToken(alice, 200n, {Ethereum: owner.eth});474 const {tokenId} = await collection.mintToken(alice, 200n, {Ethereum: owner.eth});
474 const tokenAddress = helper.ethAddress.fromTokenId(collection.collectionId, tokenId);475 const tokenAddress = helper.ethAddress.fromTokenId(collection.collectionId, tokenId);
475 const tokenContract = await helper.ethNativeContract.rftToken(tokenAddress, owner.eth);476 const tokenContract = await helper.ethNativeContract.rftToken(tokenAddress, owner.eth);
476477
477 expect(BigInt(await tokenContract.methods.balanceOfCross(owner).call({from: owner.eth})) === 200n).to.be.true;478 expect(BigInt(await tokenContract.methods.balanceOfCross(owner).call({from: owner.eth})) === 200n).to.be.true;
478
479 for (let i = 1n; i < 100n; i++) {479 expect(BigInt(await tokenContract.methods.balanceOfCross(other).call({from: owner.eth})) === 0n).to.be.true;
480
480 await tokenContract.methods.repartition(i).send({from: owner.eth});481 await tokenContract.methods.repartition(100n).send({from: owner.eth});
481 expect(BigInt(await tokenContract.methods.balanceOfCross(owner).call({from: owner.eth})) === i).to.be.true;482 expect(BigInt(await tokenContract.methods.balanceOfCross(owner).call({from: owner.eth})) === 100n).to.be.true;
482 }483 expect(BigInt(await tokenContract.methods.balanceOfCross(other).call({from: owner.eth})) === 0n).to.be.true;
484
485 await tokenContract.methods.transferCross(other, 50n).send({from: owner.eth});
486 expect(BigInt(await tokenContract.methods.balanceOfCross(owner).call({from: owner.eth})) === 50n).to.be.true;
487 expect(BigInt(await tokenContract.methods.balanceOfCross(other).call({from: owner.eth})) === 50n).to.be.true;
488
489 await tokenContract.methods.transferCross(other, 50n).send({from: owner.eth});
490 expect(BigInt(await tokenContract.methods.balanceOfCross(owner).call({from: owner.eth})) === 0n).to.be.true;
491 expect(BigInt(await tokenContract.methods.balanceOfCross(other).call({from: owner.eth})) === 100n).to.be.true;
492
493 await tokenContract.methods.repartition(1000n).send({from: other.eth});
494 await tokenContract.methods.transferCross(owner, 500n).send({from: other.eth});
495 expect(BigInt(await tokenContract.methods.balanceOfCross(owner).call({from: owner.eth})) === 500n).to.be.true;
496 expect(BigInt(await tokenContract.methods.balanceOfCross(other).call({from: owner.eth})) === 500n).to.be.true;
483 });497 });
484});498});
485499