-
Notifications
You must be signed in to change notification settings - Fork 0
/
contract.spec.ts
66 lines (62 loc) · 2.07 KB
/
contract.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
import { toNano } from "@ton/core";
import { Blockchain } from "@ton/sandbox";
import "@ton/test-utils";
import { Bet } from "./output/youbet_Bet";
import { findErrorCodeByMessage } from "./utils/error";
describe("contract", () => {
it("should deploy correctly", async () => {
// Create Sandbox and deploy contract
let system = await Blockchain.create();
let owner = await system.treasury("owner");
let contract = system.openContract(await Bet.fromInit(owner.address));
const deployResult = await contract.send(
owner.getSender(),
{ value: toNano(1) },
{ $$type: "Deploy", queryId: 0n }
);
expect(deployResult.transactions).toHaveTransaction({
from: owner.address,
to: contract.address,
deploy: true,
success: true,
});
});
});
describe("linkWallet", () => {
it("should link correctly", async () => {
// Create Sandbox and deploy contract
let system = await Blockchain.create();
let owner = await system.treasury("owner");
let contract = system.openContract(await Bet.fromInit(owner.address));
const linkResult = await contract.send(
owner.getSender(),
{ value: toNano(1) },
{ $$type: "LinkWallet", address: owner.address, github: "github" }
);
expect(linkResult.transactions).toHaveTransaction({
from: owner.address,
to: contract.address,
success: true,
});
});
});
describe("createTask", () => {
it("should create task correctly", async () => {
// Create Sandbox and deploy contract
let system = await Blockchain.create();
let owner = await system.treasury("owner");
let contract = system.openContract(await Bet.fromInit(owner.address));
const createTaskResult = await contract.send(
owner.getSender(),
{ value: toNano(1) },
{ $$type: "CreateTask", id: "123", name: "Task 1", projectId: "1" }
);
expect(createTaskResult.transactions).toHaveTransaction({
from: owner.address,
to: contract.address,
success: true,
});
const task = await contract.getAllTasks();
console.log(task);
});
});