Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

z_ui_thread_03_filetest.gno

1.23 Kb · 49 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v0/filetests/z_ui_thread_03_filetest
 2
 3// Render thread from a readonly board.
 4// Rendered thread action links should be limited to readonly actions.
 5package z_ui_thread_03_filetest
 6
 7import (
 8	"testing"
 9
10	"gno.land/p/gnoland/boards/v0"
11
12	boards2 "gno.land/r/gnoland/boards2/v0"
13)
14
15const (
16	owner     address = "g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx"
17	boardName         = "test-board"
18)
19
20var threadID boards.ID
21
22func init(cur realm) {
23	testing.SetRealm(testing.NewUserRealm(owner))
24
25	// Create a readonly board and then add a thread
26	boardID := boards2.CreateBoard(cross(cur), boardName, false, false)
27	threadID = boards2.CreateThread(cross(cur), boardID, "Foo", "Body")
28	boards2.FreezeBoard(cross(cur), boardID)
29}
30
31func main() {
32	path := boardName + "/" + threadID.String()
33	println(boards2.Render(path))
34}
35
36// Output:
37// # [Boards](/r/gnoland/boards2/v0) › [test\-board](/r/gnoland/boards2/v0:test-board)
38// ## Foo
39//
40// **[g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx](/u/g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx)** `owner` · 2009-02-13 11:31pm UTC
41//
42//
43// <gno-foreign>
44// Body
45// </gno-foreign>
46//
47//
48//
49// ↳ [Flag](/r/gnoland/boards2/v0:test-board/1/flag) • [Repost](/r/gnoland/boards2/v0:test-board/1/repost)