-
Notifications
You must be signed in to change notification settings - Fork 109
/
sample-jetton.spec.ts
80 lines (71 loc) · 2.52 KB
/
sample-jetton.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import { beginCell, toNano } from "@ton/core";
import { Blockchain, SandboxContract, TreasuryContract } from "@ton/sandbox";
import { SampleJetton } from "./contracts/output/sample-jetton_SampleJetton";
import { JettonDefaultWallet } from "./contracts/output/sample-jetton_JettonDefaultWallet";
import "@ton/test-utils";
describe("bugs", () => {
let blockchain: Blockchain;
let treasure: SandboxContract<TreasuryContract>;
let contract: SandboxContract<SampleJetton>;
let target: SandboxContract<JettonDefaultWallet>;
beforeEach(async () => {
blockchain = await Blockchain.create();
blockchain.verbosity.print = false;
treasure = await blockchain.treasury("treasure");
contract = blockchain.openContract(
await SampleJetton.fromInit(
treasure.address,
beginCell().endCell(),
toNano("100"),
),
);
target = blockchain.openContract(
await JettonDefaultWallet.fromInit(
contract.address,
treasure.address,
),
);
const deployResult = await contract.send(
treasure.getSender(),
{ value: toNano("10") },
{
$$type: "Mint",
receiver: treasure.address,
amount: toNano("10"),
},
);
expect(deployResult.transactions).toHaveTransaction({
from: treasure.address,
to: contract.address,
success: true,
deploy: true,
});
});
it("should deploy sample jetton correctly", async () => {
// Ensure that the Mint operation was successful and the transaction was correct
const mintResult = await contract.send(
treasure.getSender(),
{ value: toNano("10") },
{
$$type: "Mint",
receiver: treasure.address,
amount: toNano("10"),
},
);
expect(mintResult.transactions).toHaveTransaction({
from: treasure.address,
to: contract.address,
success: true,
});
expect(mintResult.transactions).toHaveTransaction({
from: contract.address,
op: 0x178d4519,
success: true,
});
expect(mintResult.transactions).toHaveTransaction({
to: treasure.address,
op: 0xd53276db,
});
expect((await target.getGetWalletData()).balance).toBe(toNano("20"));
});
});