You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.4 KiB

import { toNano, Address } from "ton";
import { ContractSystem } from "ton-emulator";
import {TONB} from '../output/jetton_TONB';
import { default_content } from '../utils/config';
import { TONBWallet } from '../output/jetton_TONBWallet';
describe('jetton', () => {
it('should deploy and deposit the correct sum of money', async () => {
// Create jetton
let system = await ContractSystem.create();
let owner = system.treasure('owner');
let contract = system.open(await TONB.fromInit(owner.address, default_content));
let tracker = system.track(contract.address);
let wallet_contract = system.open(await TONBWallet.fromInit(contract.address, owner.address));
// Mint
await contract.send(owner, { value: toNano('1.1') }, { $$type: 'Deposit', amount: toNano('1') });
await system.run();
let events = tracker.events();
expect(events).toMatchSnapshot();
let addr = Address.parse((events[3] as any).messages[0].to);
let wallet_contract_2 = system.contract(addr);
let wdata = (await wallet_contract_2.get(97026, [])) as any;
expect(wdata.stack.items[0].value).toEqual(1000000000n);
// Check owner
expect((await contract.getOwner()).toString()).toEqual(owner.address.toString());
// Data
let data = await contract.getGetJettonData();
});
});