1// PKGPATH: gno.land/r/demo/boards_test
2package boards_test
3
4// SEND: 200000000ugnot
5
6import (
7 "std"
8
9 "gno.land/p/demo/testutils"
10 "gno.land/r/demo/boards"
11 "gno.land/r/demo/users"
12)
13
14func main() {
15 caller := testutils.TestAddress("caller")
16 std.TestSetRealm(std.NewUserRealm(caller))
17 users.Register("", "gnouser", "my profile")
18 // create a post via registered user
19 bid1 := boards.CreateBoard("test_board1")
20 pid := boards.CreateThread(bid1, "First Post (title)", "Body of the first post. (body)")
21 bid2 := boards.CreateBoard("test_board2")
22
23 // create a repost via anon user
24 test2 := testutils.TestAddress("test2")
25 std.TestSetOriginCaller(test2)
26 std.TestSetOriginSend(std.Coins{{"ugnot", 9000000}}, nil)
27
28 rid := boards.CreateRepost(bid1, pid, "", "Check this out", bid2)
29 println(rid)
30 println(boards.Render("test_board1"))
31}
32
33// Error:
34// please register, otherwise minimum fee 100000000 is required if anonymous
z_12_a_filetest.gno
0.90 Kb ยท 34 lines