Skip to content

Commit

Permalink
fix: added another single transfer test
Browse files Browse the repository at this point in the history
  • Loading branch information
siandreev committed Sep 28, 2023
1 parent cd4f684 commit b882bf7
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion tests/wallet-v5-external.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Blockchain, SandboxContract } from '@ton-community/sandbox';
import { Address, beginCell, Cell, Dictionary, Sender, SendMode, toNano } from 'ton-core';
import { Address, beginCell, Cell, Dictionary, internal, Sender, SendMode, toNano } from 'ton-core';
import { Opcodes, WalletId, WalletV5 } from '../wrappers/wallet-v5';
import '@ton-community/test-utils';
import { compile } from '@ton-community/blueprint';
Expand Down Expand Up @@ -196,6 +196,34 @@ describe('Wallet V5 sign auth external', () => {
expect(storedWC).toEqual(BigInt(testExtension.workChain));
});

it('Send single transfers to a deployed wallet', async () => {
const forwardValue = toNano(0.001);

const { walletV5: receiver } = await deployOtherWallet();

const receiverBalanceBefore = (await blockchain.getContract(receiver.address)).balance;

const msg = internal({ to: receiver.address, value: forwardValue });

const actionsList = packActionsList([new ActionSendMsg(SendMode.PAY_GAS_SEPARATELY, msg)]);

const receipt = await walletV5.sendExternalSignedMessage(createBody(actionsList));

expect(receipt.transactions.length).toEqual(2);

expect(receipt.transactions).toHaveTransaction({
from: walletV5.address,
to: receiver.address,
value: forwardValue
});

const fee = receipt.transactions[1].totalFees.coins;

const receiverBalanceAfter = (await blockchain.getContract(receiver.address)).balance;

expect(receiverBalanceAfter).toEqual(receiverBalanceBefore + forwardValue - fee);
});

it('Send two transfers', async () => {
const testReceiver1 = Address.parse('EQAvDfWFG0oYX19jwNDNBBL1rKNT9XfaGP9HyTb5nb2Eml6y');
const forwardValue1 = toNano(0.001);
Expand Down

0 comments on commit b882bf7

Please sign in to comment.