Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

z_ui_thread_04_filetest.gno

1.70 Kb · 57 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v0/filetests/z_ui_thread_04_filetest
 2
 3// Render thread repost of a deleted thread.
 4package z_ui_thread_04_filetest
 5
 6import (
 7	"testing"
 8
 9	"gno.land/p/gnoland/boards/v0"
10
11	boards2 "gno.land/r/gnoland/boards2/v0"
12)
13
14const (
15	owner        address = "g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx"
16	srcBoardName         = "test-board"
17	dstBoardName         = "test-board-2"
18)
19
20var repostThreadID boards.ID
21
22func init(cur realm) {
23	testing.SetRealm(testing.NewUserRealm(owner))
24
25	// Create a board and a thread
26	boardID := boards2.CreateBoard(cross(cur), srcBoardName, false, false)
27	threadID := boards2.CreateThread(cross(cur), boardID, "Foo", "Body")
28
29	// Repost thread into a different board
30	dstBoardID := boards2.CreateBoard(cross(cur), dstBoardName, false, false)
31	repostThreadID = boards2.CreateRepost(cross(cur), boardID, threadID, dstBoardID, "Bar", "Body2")
32
33	// Remove the original thread
34	boards2.DeleteThread(cross(cur), boardID, threadID)
35}
36
37func main() {
38	path := dstBoardName + "/" + repostThreadID.String()
39	println(boards2.Render(path))
40}
41
42// Output:
43// # [Boards](/r/gnoland/boards2/v0) › [test\-board\-2](/r/gnoland/boards2/v0:test-board-2)
44// ## Bar
45//
46// **[g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx](/u/g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx)** `owner` · 2009-02-13 11:31pm UTC
47//
48//
49// <gno-foreign>
50// Body2
51// </gno-foreign>
52//
53//
54//
55// > ⚠ Source post has been deleted
56//
57// ↳ [Flag](/r/gnoland/boards2/v0:test-board-2/1/flag) • [Repost](/r/gnoland/boards2/v0:test-board-2/1/repost) • [Comment](/r/gnoland/boards2/v0:test-board-2/1/reply) • [Edit](/r/gnoland/boards2/v0:test-board-2/1/edit) • [Delete](/r/gnoland/boards2/v0$help&func=DeleteThread&boardID=2&threadID=1)