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