Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_ui_4_e_filetest.gno

1.58 Kb · 48 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/boards000/v1rc1"
10)
11
12const (
13	owner        address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
14	srcBoardName         = "BoardName"
15	dstBoardName         = "BoardName2"
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)
25	threadID := boards2.CreateThread(cross, boardID, "Foo", "Body")
26
27	// Repost thread into a different board
28	dstBoardID := boards2.CreateBoard(cross, dstBoardName, 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// # Bar
42//
43// > *⚠ Source post has been deleted*
44// >
45// Body2
46//
47// Created by [g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq](/u/g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq) on 2009-02-13 11:31pm UTC
48// [Flag](/r/gnoland/boards2/v1$help&func=FlagThread&boardID=2&reason=&threadID=1) • [Repost](/r/gnoland/boards2/v1$help&func=CreateRepost&boardID=2&body=&destinationBoardID=&threadID=1&title=) • [Reply](/r/gnoland/boards2/v1$help&func=CreateReply&boardID=2&body=&replyID=0&threadID=1) • [Edit](/r/gnoland/boards2/v1$help&func=EditThread&boardID=2&body=Body2&threadID=1&title=Bar) • [Delete](/r/gnoland/boards2/v1$help&func=DeleteThread&boardID=2&threadID=1)