difftreelog
fix tests
in: master
4 files changed
tests/src/eth/fungible.test.tsdiffbeforeafterboth431 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);436437437 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;438439 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++) {440441 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;444445 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;448449 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;452442 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});447458tests/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.tsdiffbeforeafterboth--- a/tests/src/eth/reFungibleToken.test.ts
+++ b/tests/src/eth/reFungibleToken.test.ts
@@ -470,16 +470,30 @@
itEth('Check balanceOfCross()', async ({helper}) => {
const collection = await helper.rft.mintCollection(alice, {});
const owner = await helper.ethCrossAccount.createAccountWithBalance(donor);
+ const other = await helper.ethCrossAccount.createAccountWithBalance(donor);
const {tokenId} = await collection.mintToken(alice, 200n, {Ethereum: owner.eth});
const tokenAddress = helper.ethAddress.fromTokenId(collection.collectionId, tokenId);
const tokenContract = await helper.ethNativeContract.rftToken(tokenAddress, owner.eth);
expect(BigInt(await tokenContract.methods.balanceOfCross(owner).call({from: owner.eth})) === 200n).to.be.true;
+ expect(BigInt(await tokenContract.methods.balanceOfCross(other).call({from: owner.eth})) === 0n).to.be.true;
+
+ await tokenContract.methods.repartition(100n).send({from: owner.eth});
+ expect(BigInt(await tokenContract.methods.balanceOfCross(owner).call({from: owner.eth})) === 100n).to.be.true;
+ expect(BigInt(await tokenContract.methods.balanceOfCross(other).call({from: owner.eth})) === 0n).to.be.true;
+
+ await tokenContract.methods.transferCross(other, 50n).send({from: owner.eth});
+ expect(BigInt(await tokenContract.methods.balanceOfCross(owner).call({from: owner.eth})) === 50n).to.be.true;
+ expect(BigInt(await tokenContract.methods.balanceOfCross(other).call({from: owner.eth})) === 50n).to.be.true;
+
+ await tokenContract.methods.transferCross(other, 50n).send({from: owner.eth});
+ expect(BigInt(await tokenContract.methods.balanceOfCross(owner).call({from: owner.eth})) === 0n).to.be.true;
+ expect(BigInt(await tokenContract.methods.balanceOfCross(other).call({from: owner.eth})) === 100n).to.be.true;
- for (let i = 1n; i < 100n; i++) {
- await tokenContract.methods.repartition(i).send({from: owner.eth});
- expect(BigInt(await tokenContract.methods.balanceOfCross(owner).call({from: owner.eth})) === i).to.be.true;
- }
+ await tokenContract.methods.repartition(1000n).send({from: other.eth});
+ await tokenContract.methods.transferCross(owner, 500n).send({from: other.eth});
+ expect(BigInt(await tokenContract.methods.balanceOfCross(owner).call({from: owner.eth})) === 500n).to.be.true;
+ expect(BigInt(await tokenContract.methods.balanceOfCross(other).call({from: owner.eth})) === 500n).to.be.true;
});
});