z_ui_4_d_filetest.gno
1.03 Kb · 38 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 boards2 "gno.land/r/gnoland/boards2/v1"
9)
10
11const (
12 owner = address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
13 boardName = "BoardName"
14)
15
16var threadID boards2.PostID
17
18func init() {
19 testing.SetRealm(testing.NewUserRealm(owner))
20
21 // Create a readonly board and then add a thread
22 boardID := boards2.CreateBoard(cross, boardName, false)
23 threadID = boards2.CreateThread(cross, boardID, "Foo", "Body")
24 boards2.FreezeBoard(cross, boardID)
25}
26
27func main() {
28 path := boardName + "/" + threadID.String()
29 println(boards2.Render(path))
30}
31
32// Output:
33// # Foo
34//
35// Body
36//
37// Created by [g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq](/u/g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq) on 2009-02-13 11:31pm UTC
38// [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=)