forked from tact-lang/tact
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathincrement.spec.ts
35 lines (29 loc) · 1.47 KB
/
increment.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { IncrementContract } from "./output/increment_IncrementContract";
import { ContractSystem } from "ton-emulator";
import { toNano } from "ton-core";
describe('increment', () => {
it('should deploy', async () => {
// Create wallet
let system = await ContractSystem.create();
let treasure = system.treasure('treasure');
let contract = system.open(await IncrementContract.fromInit());
let tracker = system.track(contract.address);
await contract.send(treasure, { value: toNano('10') }, { $$type: 'Deploy', queryId: 0n });
await system.run();
expect(tracker.collect()).toMatchSnapshot();
// Send internal message
await contract.send(treasure, { value: toNano('10') }, { $$type: 'Increment', key: 0n, value: -1232n });
await system.run();
expect(tracker.collect()).toMatchSnapshot();
// Get counters
let counters = await contract.getCounters();
let counters2 = await contract.getCounters2();
// let res = await executor.get('counters');
// let dict = parseDict(res.stack.readCell().beginParse(), 257, (sc) => sc.readInt(257).toString(10));
// // console.warn(dict);
// let res2 = await executor.get('counters2');
// let dict2 = parseDict(res2.stack.readCell().beginParse(), 267, (sc) => sc.readInt(257).toString(10));
// // console.warn(dict2);
// // new BN(Array.from(dict.keys())[0]).toString('hex');
});
});