difftreelog
Add more transferCross tests
in: master
2 files changed
tests/src/eth/fungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/fungible.test.ts
+++ b/tests/src/eth/fungible.test.ts
@@ -276,6 +276,21 @@
expect(balance).to.equal(50n);
}
});
+
+ itEth('Cannot transferCross() more than have', async ({helper}) => {
+ const sender = await helper.eth.createAccountWithBalance(donor);
+ const receiverEth = await helper.eth.createAccountWithBalance(donor);
+ const receiverCrossEth = helper.ethCrossAccount.fromAddress(receiverEth);
+ const BALANCE = 200n;
+ const BALANCE_TO_TRANSFER = BALANCE + 100n;
+
+ const collection = await helper.ft.mintCollection(alice);
+ await collection.mint(alice, BALANCE, {Ethereum: sender});
+ const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'ft', sender);
+
+ await expect(collectionEvm.methods.transferCross(receiverCrossEth, BALANCE_TO_TRANSFER).send({from: sender})).to.be.rejected;
+ });
itEth('Can perform transfer()', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
tests/src/eth/reFungible.test.tsdiffbeforeafterboth415415416 itEth('Cannot transferCross with invalid params', async ({helper}) => {416 itEth('Cannot transferCross with invalid params', async ({helper}) => {417 const sender = await helper.eth.createAccountWithBalance(donor);417 const sender = await helper.eth.createAccountWithBalance(donor);418 const tokenOwner = await helper.eth.createAccountWithBalance(donor);418 const receiverCrossSub = helper.ethCrossAccount.fromKeyringPair(minter);419 const receiverCrossSub = helper.ethCrossAccount.fromKeyringPair(minter);419420420 const collection = await helper.rft.mintCollection(minter, {});421 const collection = await helper.rft.mintCollection(minter, {});421 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);422 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);422 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'rft', sender);423 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'rft', sender);423424425 await collection.mintToken(minter, 50n, {Ethereum: sender});424 const {tokenId} = await collection.mintToken(minter, 50n, {Ethereum: sender});426 const notSendersToken = await collection.mintToken(minter, 50n, {Ethereum: tokenOwner});425 // FIXME (transaction successful): Cannot transfer token if it does not exist:427 // Cannot transferCross someone else's token:426 await expect(collectionEvm.methods.transferCross(receiverCrossSub, tokenId + 1).send({from: sender})).to.be.rejected;428 await expect(collectionEvm.methods.transferCross(receiverCrossSub, notSendersToken.tokenId).send({from: sender})).to.be.rejected;429 // FIXME: (transaction successful): Cannot transfer token if it does not exist:430 await expect(collectionEvm.methods.transferCross(receiverCrossSub, 999999).send({from: sender})).to.be.rejected;427 });431 });428432429 itEth('transfer event on transfer from partial ownership to full ownership', async ({helper}) => {433 itEth('transfer event on transfer from partial ownership to full ownership', async ({helper}) => {