Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_delete_thread_00_filetest.gno

0.79 Kb · 40 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v1/filetests/z_delete_thread_00_filetest
 2
 3package z_delete_thread_00_filetest
 4
 5import (
 6	"testing"
 7
 8	"gno.land/p/gnoland/boards"
 9
10	boards2 "gno.land/r/gnoland/boards2/v1"
11)
12
13const (
14	owner address = "g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh"
15	title         = "Test Thread"
16	body          = "Test body"
17)
18
19var (
20	bid boards.ID
21	pid boards.ID
22)
23
24func init(cur realm) {
25	testing.SetRealm(testing.NewUserRealm(owner))
26	bid = boards2.CreateBoard(cross(cur), "test-board", false, false)
27	pid = boards2.CreateThread(cross(cur), bid, title, body)
28}
29
30func main(cur realm) {
31	testing.SetRealm(testing.NewUserRealm(owner))
32
33	boards2.DeleteThread(cross(cur), bid, pid)
34
35	// Ensure thread doesn't exist
36	println(boards2.Render("test-board/1"))
37}
38
39// Output:
40// Thread not found