Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_5_a_filetest.gno

0.91 Kb · 32 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v1/hub/filetests/z_5_a_filetest
 2
 3// Test getting reposts from a thread without reposts
 4package z_5_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 thread hub.Thread
14
15func init(cur realm) {
16	testing.SetRealm(testing.NewUserRealm("g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh"))
17	boardID := boards2.CreateBoard(cross(cur), "aaa123", false, false)
18	threadID := boards2.CreateThread(cross(cur), boardID, "Title", "Body")
19
20	// Get readonly thread
21	testing.SetRealm(testing.NewCodeRealm("gno.land/r/gnoland/boards2/test"))
22	thread, _ = hub.GetThread(cross(cur), uint64(boardID), uint64(threadID))
23}
24
25func main(cur realm) {
26	testing.SetRealm(testing.NewCodeRealm("gno.land/r/gnoland/boards2/test"))
27	reposts := hub.GetReposts(cross(cur), thread.BoardID, thread.ID, 0, thread.RepostCount)
28	println(len(reposts))
29}
30
31// Output:
32// 0