Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

z_flag_thread_00_filetest.gno

1.48 Kb · 51 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v0/filetests/z_flag_thread_00_filetest
 2
 3package z_flag_thread_00_filetest
 4
 5import (
 6	"testing"
 7
 8	"gno.land/p/gnoland/boards/v0"
 9
10	boards2 "gno.land/r/gnoland/boards2/v0"
11)
12
13const (
14	owner     address = "g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx"
15	moderator address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
16)
17
18var (
19	bid boards.ID
20	pid boards.ID
21)
22
23func init(cur realm) {
24	testing.SetRealm(testing.NewUserRealm(owner))
25	bid = boards2.CreateBoard(cross(cur), "test-board", false, false)
26
27	// Invite a moderator to the new board
28	boards2.InviteMember(cross(cur), bid, moderator, boards2.RoleModerator)
29
30	// Create a new thread as a moderator
31	pid = boards2.CreateThread(cross(cur), bid, "Foo", "bar")
32}
33
34func main(cur realm) {
35	testing.SetRealm(testing.NewUserRealm(owner))
36
37	// Flag thread as owner
38	boards2.FlagThread(cross(cur), bid, pid, "Reason")
39
40	// Ensure thread is not listed
41	println(boards2.Render("test-board"))
42}
43
44// Output:
45// # [Boards](/r/gnoland/boards2/v0) › test-board
46// Created by [g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx](/u/g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx) on 2009-02-13 11:31pm UTC, #1
47// ↳ [Create Thread](/r/gnoland/boards2/v0:test-board/create-thread) • [Request Invite](/r/gnoland/boards2/v0$help&func=RequestInvite&boardID=1) • [Manage Board](?menu=manageBoard)
48//
49// ---
50// ### This board doesn't have any threads
51// Do you want to [start a new conversation](/r/gnoland/boards2/v0:test-board/create-thread) in this board?