z_9_a_filetest.gno

0.64 Kb ยท 37 lines
 1package main
 2
 3import (
 4	"std"
 5	"testing"
 6
 7	boards2 "gno.land/r/gnoland/boards2/v1"
 8)
 9
10const (
11	owner = std.Address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
12	title = "Test Thread"
13	body  = "Test body"
14)
15
16var (
17	bid boards2.BoardID
18	pid boards2.PostID
19)
20
21func init() {
22	testing.SetRealm(std.NewUserRealm(owner))
23	bid = boards2.CreateBoard(cross, "test-board", false)
24	pid = boards2.CreateThread(cross, bid, title, body)
25}
26
27func main() {
28	testing.SetRealm(std.NewUserRealm(owner))
29
30	boards2.DeleteThread(cross, bid, pid)
31
32	// Ensure thread doesn't exist
33	println(boards2.Render("test-board/1"))
34}
35
36// Output:
37// Thread does not exist with ID: 1