Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_ui_thread_03_filetest.gno

1.23 Kb · 49 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v1/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"
11
12	boards2 "gno.land/r/gnoland/boards2/v1"
13)
14
15const (
16	owner     address = "g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh"
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/v1) › [test\-board](/r/gnoland/boards2/v1:test-board)
38// ## Foo
39//
40// **[g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh](/u/g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh)** `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/v1:test-board/1/flag) • [Repost](/r/gnoland/boards2/v1:test-board/1/repost)