Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_5_a_filetest.gno

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