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