z_8_a_filetest.gno
1.03 Kb · 33 lines
1// PKGPATH: gno.land/r/gnoland/boards2/v1/hub/filetests/z_8_a_filetest
2
3// Test getting replies from a comment without replies
4package z_8_a_filetest
5
6import (
7 "testing"
8
9 boards2 "gno.land/r/gnoland/boards2/v1"
10 "gno.land/r/gnoland/boards2/v1/hub"
11)
12
13var comment hub.Comment
14
15func init(cur realm) {
16 testing.SetRealm(testing.NewUserRealm("g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh"))
17 boardID := boards2.CreateBoard(cross(cur), "test123", false, false)
18 threadID := boards2.CreateThread(cross(cur), boardID, "Title", "Body")
19 commentID := boards2.CreateReply(cross(cur), boardID, threadID, 0, "Comment")
20
21 // Get readonly comment
22 testing.SetRealm(testing.NewCodeRealm("gno.land/r/gnoland/boards2/test"))
23 comment, _ = hub.GetComment(cross(cur), uint64(boardID), uint64(threadID), uint64(commentID))
24}
25
26func main(cur realm) {
27 testing.SetRealm(testing.NewCodeRealm("gno.land/r/gnoland/boards2/test"))
28 replies := hub.GetReplies(cross(cur), comment.BoardID, comment.ThreadID, comment.ID, 0, comment.ReplyCount)
29 println(len(replies))
30}
31
32// Output:
33// 0