Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_ui_thread_03_filetest.gno

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