z_15_e_filetest.gno
1.00 Kb ยท 40 lines
1package main
2
3import (
4 "std"
5 "testing"
6
7 boards2 "gno.land/r/gnoland/boards2/v1"
8)
9
10const owner = std.Address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
11
12var (
13 srcBID boards2.BoardID
14 dstBID boards2.BoardID
15 srcTID boards2.PostID
16)
17
18func init() {
19 testing.SetRealm(std.NewUserRealm(owner))
20
21 // Create a board with a thread
22 origBID := boards2.CreateBoard(cross, "origin-board", false)
23 origTID := boards2.CreateThread(cross, origBID, "title", "text")
24
25 // Create a second board and repost a thread using an empty title
26 srcBID = boards2.CreateBoard(cross, "source-board", false)
27 srcTID = boards2.CreateRepost(cross, origBID, origTID, "original title", "original text", srcBID)
28
29 // Create a third board to try reposting the repost
30 dstBID = boards2.CreateBoard(cross, "destination-board", false)
31}
32
33func main() {
34 testing.SetRealm(std.NewUserRealm(owner))
35
36 boards2.CreateRepost(cross, srcBID, srcTID, "repost title", "repost text", dstBID)
37}
38
39// Error:
40// reposting a thread that is a repost is not allowed