difftreelog
fix tests
in: master
4 files changed
tests/src/eth/fungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/fungible.test.ts
+++ b/tests/src/eth/fungible.test.ts
@@ -431,17 +431,28 @@
itEth('Check balanceOfCross()', async ({helper}) => {
const collection = await helper.ft.mintCollection(alice, {});
const owner = await helper.ethCrossAccount.createAccountWithBalance(donor);
+ const other = await helper.ethCrossAccount.createAccountWithBalance(donor);
const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner.eth);
expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 0n).to.be.true;
+ expect(BigInt(await collectionEvm.methods.balanceOfCross(other).call({from: owner.eth})) === 0n).to.be.true;
+
+ await collection.mint(alice, 100n, {Ethereum: owner.eth});
+ expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 100n).to.be.true;
+ expect(BigInt(await collectionEvm.methods.balanceOfCross(other).call({from: owner.eth})) === 0n).to.be.true;
- let sum = 0n;
- for (let i = 1n; i < 100n; i++) {
- await collection.mint(alice, 100n, {Ethereum: owner.eth});
- sum += 100n;
- expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === sum).to.be.true;
- }
+ await collectionEvm.methods.transferCross(other, 50n).send({from: owner.eth});
+ expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 50n).to.be.true;
+ expect(BigInt(await collectionEvm.methods.balanceOfCross(other).call({from: owner.eth})) === 50n).to.be.true;
+
+ await collectionEvm.methods.transferCross(other, 50n).send({from: owner.eth});
+ expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 0n).to.be.true;
+ expect(BigInt(await collectionEvm.methods.balanceOfCross(other).call({from: owner.eth})) === 100n).to.be.true;
+
+ await collectionEvm.methods.transferCross(owner, 100n).send({from: other.eth});
+ expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 100n).to.be.true;
+ expect(BigInt(await collectionEvm.methods.balanceOfCross(other).call({from: owner.eth})) === 0n).to.be.true;
});
});
tests/src/eth/nonFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -671,7 +671,7 @@
expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 0n).to.be.true;
- for (let i = 1n; i < 100n; i++) {
+ for (let i = 1n; i < 10n; i++) {
await collection.mintToken(minter, {Ethereum: owner.eth});
expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === i).to.be.true;
}
tests/src/eth/reFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/reFungible.test.ts
+++ b/tests/src/eth/reFungible.test.ts
@@ -593,7 +593,7 @@
expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 0n).to.be.true;
- for (let i = 1n; i < 100n; i++) {
+ for (let i = 1n; i < 10n; i++) {
await collection.mintToken(minter, 100n, {Ethereum: owner.eth});
expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === i).to.be.true;
}
tests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth470 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);476477477 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;478479 for (let i = 1n; i < 100n; i++) {479 expect(BigInt(await tokenContract.methods.balanceOfCross(other).call({from: owner.eth})) === 0n).to.be.true;480480 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;484485 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;488489 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;492493 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