From 35a5d3160a05b4c83b47a61d9a25c56079d53503 Mon Sep 17 00:00:00 2001 From: Logan Nguyen Date: Tue, 12 Nov 2024 17:11:58 -0600 Subject: [PATCH] test: added coverage for tokenAirdrop to a smart contract Signed-off-by: Logan Nguyen --- .../token-airdrop/tokenAirdropContract.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/system-contracts/hedera-token-service/token-airdrop/tokenAirdropContract.js b/test/system-contracts/hedera-token-service/token-airdrop/tokenAirdropContract.js index 3a8b9cd5..066c6533 100644 --- a/test/system-contracts/hedera-token-service/token-airdrop/tokenAirdropContract.js +++ b/test/system-contracts/hedera-token-service/token-airdrop/tokenAirdropContract.js @@ -80,6 +80,25 @@ describe.only('HRC904Contract Test Suite', function () { expect(receipt.status).to.eq(1); }); + it('should revert for tokenAirdrop to a smart contract', async function () { + try { + const tx = await airdropContract.tokenAirdrop( + tokenAddress, + signers[0].address, + tokenCreateContract.target, + 1, + { + gasLimit: 2_000_000, + value: 100_000, + } + ); + await tx.wait(); + expect.fail('Should revert'); + } catch (error) { + expect(error.code).to.eq(Constants.CALL_EXCEPTION); + } + }); + it('should be able to airdrop any token in its balance based on token address', async function () { const tx = await airdropContract.tokenAirdrop( tokenAddress,