z_ui_4_d_filetest.gno
1.06 Kb · 40 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/boards000/v1rc1"
11)
12
13const (
14 owner address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
15 boardName = "BoardName"
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)
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// # Foo
36//
37// Body
38//
39// Created by [g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq](/u/g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq) on 2009-02-13 11:31pm UTC
40// [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=)