z_create_thread_00_filetest.gno
1.32 Kb · 49 lines
1package main
2
3import (
4 "testing"
5
6 "gno.land/p/gnoland/boards"
7
8 boards2 "gno.land/r/gnoland/boards2/v1"
9)
10
11const (
12 owner address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq"
13 title = "Test Thread"
14 body = "Test body"
15 path = "test-board/1"
16)
17
18var bid boards.ID
19
20func init() {
21 testing.SetRealm(testing.NewUserRealm(owner))
22 bid = boards2.CreateBoard(cross, "test-board", false, false)
23}
24
25func main() {
26 testing.SetRealm(testing.NewUserRealm(owner))
27
28 tid := boards2.CreateThread(cross, bid, title, body)
29
30 // Ensure that returned ID is right
31 println(tid == 1)
32
33 // Thread should not be frozen by default
34 println(boards2.IsThreadFrozen(bid, tid))
35
36 // Render content must contains thread's title and body
37 println(boards2.Render(path))
38}
39
40// Output:
41// true
42// false
43// # [Boards](/r/gnoland/boards2/v1) › [test\-board](/r/gnoland/boards2/v1:test-board)
44// ## Test Thread
45//
46// **[g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq](/u/g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq)** `owner` · 2009-02-13 11:31pm UTC
47// Test body
48//
49// ↳ [Flag](/r/gnoland/boards2/v1:test-board/1/flag) • [Repost](/r/gnoland/boards2/v1:test-board/1/repost) • [Comment](/r/gnoland/boards2/v1:test-board/1/reply) • [Edit](/r/gnoland/boards2/v1:test-board/1/edit) • [Delete](/r/gnoland/boards2/v1$help&func=DeleteThread&boardID=1&threadID=1)