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