z_2_a_filetest.gno
0.77 Kb ยท 43 lines
1package main
2
3import (
4 "std"
5 "strings"
6 "testing"
7
8 boards2 "gno.land/r/gnoland/boards2/v1"
9)
10
11const (
12 owner = std.Address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
13 path = "test-board/1/2"
14 comment = "Test comment"
15)
16
17var (
18 bid boards2.BoardID
19 tid boards2.PostID
20)
21
22func init() {
23 testing.SetRealm(std.NewUserRealm(owner))
24 bid = boards2.CreateBoard(cross, "test-board", false)
25 tid = boards2.CreateThread(cross, bid, "Foo", "bar")
26}
27
28func main() {
29 testing.SetRealm(std.NewUserRealm(owner))
30
31 rid := boards2.CreateReply(cross, bid, tid, 0, comment)
32
33 // Ensure that returned ID is right
34 println(rid == 2)
35
36 // Render content must contain the reply
37 content := boards2.Render(path)
38 println(strings.Contains(content, "\n> "+comment+"\n"))
39}
40
41// Output:
42// true
43// true