Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_15_d_filetest.gno

0.92 Kb ยท 43 lines
 1package main
 2
 3import (
 4	"strings"
 5	"testing"
 6
 7	"gno.land/p/nt/ufmt"
 8	boards2 "gno.land/r/gnoland/boards2/v1"
 9)
10
11const owner address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
12
13var (
14	srcBID boards2.BoardID
15	dstBID boards2.BoardID
16	srcTID boards2.PostID
17)
18
19func init() {
20	testing.SetRealm(testing.NewUserRealm(owner))
21	srcBID = boards2.CreateBoard(cross, "src-board", false)
22	dstBID = boards2.CreateBoard(cross, "dst-board", false)
23
24	srcTID = boards2.CreateThread(cross, srcBID, "original title", "original text")
25}
26
27func main() {
28	testing.SetRealm(testing.NewUserRealm(owner))
29
30	// Success case
31	tID := boards2.CreateRepost(cross, srcBID, srcTID, "repost title", "repost text", dstBID)
32	p := ufmt.Sprintf("dst-board/%s", tID)
33	out := boards2.Render(p)
34
35	println(strings.Contains(out, "original text"))
36	println(strings.Contains(out, "repost title"))
37	println(strings.Contains(out, "repost text"))
38}
39
40// Output:
41// true
42// true
43// true