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