forked from tact-lang/tact
-
Notifications
You must be signed in to change notification settings - Fork 0
/
increment.spec.ts
50 lines (43 loc) · 1.49 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { IncrementContract } from "./output/increment_IncrementContract";
import { Blockchain, SandboxContract, TreasuryContract } from "@ton/sandbox";
import { toNano } from "@ton/core";
import "@ton/test-utils";
describe("increment", () => {
let blockchain: Blockchain;
let treasure: SandboxContract<TreasuryContract>;
let contract: SandboxContract<IncrementContract>;
beforeEach(async () => {
blockchain = await Blockchain.create();
blockchain.verbosity.print = false;
treasure = await blockchain.treasury("treasure");
contract = blockchain.openContract(await IncrementContract.fromInit());
const result = await contract.send(
treasure.getSender(),
{ value: toNano("10") },
{ $$type: "Deploy", queryId: 0n },
);
expect(result.transactions).toHaveTransaction({
from: treasure.address,
to: contract.address,
success: true,
deploy: true,
});
});
it("should deploy", async () => {});
it("should increment", async () => {
await contract.send(
treasure.getSender(),
{
value: toNano("10"),
},
{
$$type: "Increment",
key: 0n,
value: -1232n,
},
);
const counters = await contract.getCounters();
expect(counters.size).toEqual(1);
expect(counters.get(0n)).toEqual(-1232n);
});
});