Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_12_a_filetest.gno

1.01 Kb · 33 lines
 1package main
 2
 3// SEND: 1000000ugnot
 4
 5import (
 6	"chain"
 7	"testing"
 8
 9	"gno.land/p/nt/testutils/v0"
10	"gno.land/r/archive/boards"
11	uinit "gno.land/r/sys/users/init"
12)
13
14func main() {
15	testing.SetRealm(testing.NewUserRealm(address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))) // so that CurrentRealm.Addr() matches OrigCaller
16	uinit.RegisterUser(cross, "gnouser123", address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))
17	// create a post via registered user
18	bid1 := boards.CreateBoard(cross, "test_board1")
19	pid := boards.CreateThread(cross, bid1, "First Post (title)", "Body of the first post. (body)")
20	bid2 := boards.CreateBoard(cross, "test_board2")
21
22	// create a repost via anon user
23	test2 := testutils.TestAddress("test2")
24	testing.SetOriginCaller(test2)
25	testing.SetOriginSend(chain.Coins{{"ugnot", 9000000}})
26
27	rid := boards.CreateRepost(cross, bid1, pid, "", "Check this out", bid2)
28	println(rid)
29	println(boards.Render("test_board1"))
30}
31
32// Error:
33// please register, otherwise minimum fee 100000000 is required if anonymous