Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_9_a_filetest.gno

1.28 Kb · 59 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v1/hub/filetests/z_9_a_filetest
 2
 3// Test default thread comment values
 4package z_9_a_filetest
 5
 6import (
 7	"testing"
 8
 9	"gno.land/p/gnoland/boards"
10
11	boards2 "gno.land/r/gnoland/boards2/v1"
12	"gno.land/r/gnoland/boards2/v1/hub"
13)
14
15var (
16	boardID   boards.ID
17	threadID  boards.ID
18	commentID boards.ID
19)
20
21func init(cur realm) {
22	testing.SetRealm(testing.NewUserRealm("g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh"))
23	boardID = boards2.CreateBoard(cross(cur), "origin123", false, false)
24	threadID = boards2.CreateThread(cross(cur), boardID, "Title", "Body")
25	commentID = boards2.CreateReply(cross(cur), boardID, threadID, 0, "Comment")
26}
27
28func main(cur realm) {
29	testing.SetRealm(testing.NewCodeRealm("gno.land/r/gnoland/boards2/test"))
30	comment, found := hub.GetComment(cross(cur), uint64(boardID), uint64(threadID), uint64(commentID))
31	if !found {
32		return
33	}
34
35	println(comment.ID)
36	println(comment.BoardID)
37	println(comment.ThreadID)
38	println(comment.ParentID)
39	println(comment.Body)
40	println(comment.Hidden)
41	println(comment.ReplyCount)
42	println(comment.FlagCount)
43	println(comment.Creator)
44	println(comment.CreatedAt)
45	println(comment.UpdatedAt)
46}
47
48// Output:
49// 2
50// 1
51// 1
52// 1
53// Comment
54// false
55// 0
56// 0
57// g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh
58// 1234567890
59// 0