z_ui_4_f_filetest.gno

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