z_ui_4_d_filetest.gno

1.04 Kb · 39 lines
 1// Render thread from a readonly board.
 2// Rendered thread action links should be limited to readonly actions.
 3package main
 4
 5import (
 6	"std"
 7	"testing"
 8
 9	boards2 "gno.land/r/gnoland/boards2/v1"
10)
11
12const (
13	owner     = std.Address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
14	boardName = "BoardName"
15)
16
17var threadID boards2.PostID
18
19func init() {
20	testing.SetRealm(std.NewUserRealm(owner))
21
22	// Create a readonly board and then add a thread
23	boardID := boards2.CreateBoard(cross, boardName, false)
24	threadID = boards2.CreateThread(cross, boardID, "Foo", "Body")
25	boards2.FreezeBoard(cross, boardID)
26}
27
28func main() {
29	path := boardName + "/" + threadID.String()
30	println(boards2.Render(path))
31}
32
33// Output:
34// # Foo
35//
36// Body
37//
38// Created by [g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq](/u/g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq) on 2009-02-13 11:31pm UTC
39// [Flag](/r/gnoland/boards2/v1$help&func=FlagThread&boardID=1&reason=&threadID=1) • [Repost](/r/gnoland/boards2/v1$help&func=CreateRepost&boardID=1&body=&destinationBoardID=&threadID=1&title=)