Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_15_e_filetest.gno

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