z_21_b_filetest.gno

0.66 Kb ยท 32 lines
 1package main
 2
 3import (
 4	"std"
 5	"strings"
 6	"testing"
 7
 8	boards2 "gno.land/r/gnoland/boards2/v1"
 9)
10
11const owner = std.Address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
12
13func init() {
14	// Set an initial message so it can be cleared
15	testing.SetRealm(std.NewUserRealm(owner))
16	boards2.SetRealmNotice(cross, "This is a test realm message")
17}
18
19func main() {
20	testing.SetRealm(std.NewUserRealm(owner))
21
22	boards2.SetRealmNotice(cross, "")
23
24	// Render content must contain the message
25	content := boards2.Render("")
26	println(strings.HasPrefix(content, "> This is a test realm message\n\n"))
27	println(strings.HasPrefix(content, "# Boards"))
28}
29
30// Output:
31// false
32// true