Files
WorkshopBlockchainGift/tests/Gift.spec.ts
2026-03-07 14:15:48 +03:00

42 lines
1.2 KiB
TypeScript

import { Blockchain, SandboxContract, TreasuryContract } from '@ton/sandbox';
import { toNano } from '@ton/core';
import { Gift } from '../build/Gift/Gift_Gift';
import '@ton/test-utils';
describe('Gift', () => {
let blockchain: Blockchain;
let deployer: SandboxContract<TreasuryContract>;
let gift: SandboxContract<Gift>;
beforeEach(async () => {
blockchain = await Blockchain.create();
deployer = await blockchain.treasury('deployer');
const content = { $$type: 'Content' as const, content: 'test', imageUrl: null };
const receiver = deployer.address;
gift = blockchain.openContract(await Gift.fromInit(content, receiver));
const deployResult = await gift.send(
deployer.getSender(),
{
value: toNano('0.05'),
},
null,
);
expect(deployResult.transactions).toHaveTransaction({
from: deployer.address,
to: gift.address,
deploy: true,
success: true,
});
});
it('should deploy', async () => {
// the check is done inside beforeEach
// blockchain and gift are ready to use
});
});