Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_2_b_filetest.gno

0.75 Kb · 32 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v1/hub/filetests/z_2_b_filetest
 2
 3// Test getting boards
 4package z_2_b_filetest
 5
 6import (
 7	"testing"
 8
 9	boards2 "gno.land/r/gnoland/boards2/v1"
10	"gno.land/r/gnoland/boards2/v1/hub"
11)
12
13func init(cur realm) {
14	testing.SetRealm(testing.NewUserRealm("g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh"))
15	boards2.CreateBoard(cross(cur), "aaa123", false, false)
16	boards2.CreateBoard(cross(cur), "bbb123", false, false)
17	boards2.CreateBoard(cross(cur), "ccc123", false, false)
18}
19
20func main(cur realm) {
21	testing.SetRealm(testing.NewCodeRealm("gno.land/r/gnoland/boards2/test"))
22	boards := hub.GetBoards(cross(cur), 0, boards2.BoardCount())
23
24	for _, b := range boards {
25		println(b.ID, b.Name)
26	}
27}
28
29// Output:
30// 1 aaa123
31// 2 bbb123
32// 3 ccc123