z_ui_4_e_filetest.gno

1.55 Kb · 47 lines
 1// Render thread repost of a deleted thread.
 2package main
 3
 4import (
 5	"std"
 6	"testing"
 7
 8	boards2 "gno.land/r/gnoland/boards2/v1"
 9)
10
11const (
12	owner        = std.Address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
13	srcBoardName = "BoardName"
14	dstBoardName = "BoardName2"
15)
16
17var repostThreadID boards2.PostID
18
19func init() {
20	testing.SetRealm(std.NewUserRealm(owner))
21
22	// Create a board and a thread
23	boardID := boards2.CreateBoard(cross, srcBoardName, false)
24	threadID := boards2.CreateThread(cross, boardID, "Foo", "Body")
25
26	// Repost thread into a different board
27	dstBoardID := boards2.CreateBoard(cross, dstBoardName, false)
28	repostThreadID = boards2.CreateRepost(cross, boardID, threadID, "Bar", "Body2", dstBoardID)
29
30	// Remove the original thread
31	boards2.DeleteThread(cross, boardID, threadID)
32}
33
34func main() {
35	path := dstBoardName + "/" + repostThreadID.String()
36	println(boards2.Render(path))
37}
38
39// Output:
40// # Bar
41//
42// > *⚠ Source post has been deleted*
43// >
44// Body2
45//
46// Created by [g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq](/u/g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq) on 2009-02-13 11:31pm UTC
47// [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)