z_12_b_filetest.gno

0.69 Kb ยท 29 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	caller := testutils.TestAddress("caller")
16	std.TestSetRealm(std.NewUserRealm(caller))
17	users.Register("", "gnouser", "my profile")
18	bid1 := boards.CreateBoard("test_board1")
19	pid := boards.CreateThread(bid1, "First Post (title)", "Body of the first post. (body)")
20	bid2 := boards.CreateBoard("test_board2")
21
22	// create a repost to a non-existing board
23	rid := boards.CreateRepost(5, pid, "", "Check this out", bid2)
24	println(rid)
25	println(boards.Render("test_board1"))
26}
27
28// Error:
29// src board not exist