Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_ui_thread_04_filetest.gno

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