Search Apps Documentation Source Content File Folder Download Copy

z_12_a_filetest.gno

0.81 Kb ยท 32 lines
 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	users.Register("", "gnouser", "my profile")
16	// create a post via registered user
17	bid1 := boards.CreateBoard("test_board1")
18	pid := boards.CreateThread(bid1, "First Post (title)", "Body of the first post. (body)")
19	bid2 := boards.CreateBoard("test_board2")
20
21	// create a repost via anon user
22	test2 := testutils.TestAddress("test2")
23	std.TestSetOrigCaller(test2)
24	std.TestSetOrigSend(std.Coins{{"ugnot", 9000000}}, nil)
25
26	rid := boards.CreateRepost(bid1, pid, "", "Check this out", bid2)
27	println(rid)
28	println(boards.Render("test_board1"))
29}
30
31// Error:
32// please register, otherwise minimum fee 100000000 is required if anonymous