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