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