z_ui_4_f_filetest.gno

0.76 Kb ยท 36 lines
 1// Render thread which has been flagged.
 2package main
 3
 4import (
 5	"std"
 6	"testing"
 7
 8	boards2 "gno.land/r/gnoland/boards2/v1"
 9)
10
11const (
12	owner     = std.Address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
13	boardName = "BoardName"
14)
15
16var threadID boards2.PostID
17
18func init() {
19	testing.SetRealm(std.NewUserRealm(owner))
20
21	// Create a readonly board and then add a thread
22	boardID := boards2.CreateBoard(cross, boardName, false)
23	threadID = boards2.CreateThread(cross, boardID, "Foo", "Body")
24
25	// Flag the thread
26	boards2.SetFlaggingThreshold(cross, boardID, 1)
27	boards2.FlagThread(cross, boardID, threadID, "")
28}
29
30func main() {
31	path := boardName + "/" + threadID.String()
32	println(boards2.Render(path))
33}
34
35// Output:
36// Thread with ID: 1 has been flagged as inappropriate