Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

z_hub_0_b_filetest.gno

1.21 Kb · 59 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v1/filetests/z_hub_0_b_filetest
 2
 3// Test non default board values
 4package z_hub_0_b_filetest
 5
 6import (
 7	"testing"
 8
 9	"gno.land/p/gnoland/boards"
10
11	boards2 "gno.land/r/gnoland/boards2/v1"
12)
13
14var boardID boards.ID
15
16func init(cur realm) {
17	testing.SetRealm(testing.NewUserRealm("g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh"))
18	boardID = boards2.CreateBoard(cross(cur), "test123", false, false)
19
20	// Invite member
21	boards2.InviteMember(cross(cur), boardID, "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj", "admin")
22
23	// Rename board
24	boards2.RenameBoard(cross(cur), "test123", "foo123")
25
26	// Create a thread
27	boards2.CreateThread(cross(cur), boardID, "Title", "Body")
28
29	// Freeze board
30	boards2.FreezeBoard(cross(cur), boardID)
31}
32
33func main(cur realm) {
34	board, found := boards2.GetBoard(uint64(boardID))
35	if !found {
36		return
37	}
38
39	println(board.ID())
40	println(board.Name())
41	println(board.Aliases())
42	println(board.Readonly())
43	println(board.ThreadCount())
44	println(board.MemberCount())
45	println(board.Creator())
46	println(board.CreatedAt())
47	println(board.UpdatedAt())
48}
49
50// Output:
51// 1
52// foo123
53// slice[("test123" string)]
54// true
55// 1
56// 2
57// g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh
58// 1234567890
59// 1234567890