z_12_b_filetest.gno

0.72 Kb ยท 28 lines
 1// PKGPATH: gno.land/r/demo/boards_test
 2package boards_test
 3
 4// SEND: 1000000ugnot
 5
 6import (
 7	"std"
 8	"testing"
 9
10	"gno.land/r/demo/boards"
11	users "gno.land/r/gnoland/users/v1"
12)
13
14func main() {
15	testing.SetRealm(std.NewUserRealm(std.Address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))) // so that CurrentRealm.Addr() matches OrigCaller
16	users.Register("gnouser123")
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 to a non-existing board
22	rid := boards.CreateRepost(5, pid, "", "Check this out", bid2)
23	println(rid)
24	println(boards.Render("test_board1"))
25}
26
27// Error:
28// src board not exist