Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_create_repost_04_filetest.gno

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