-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add filtetest for reply flagging by a member with permissions
- Loading branch information
1 parent
a847c73
commit fd80af5
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package main | ||
|
||
import ( | ||
"std" | ||
"strings" | ||
|
||
"gno.land/r/nt/boards2" | ||
) | ||
|
||
const ( | ||
owner = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1 | ||
moderator = std.Address("g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj") // @test2 | ||
) | ||
|
||
var ( | ||
bid boards2.BoardID | ||
rid, tid boards2.PostID | ||
) | ||
|
||
func init() { | ||
std.TestSetOrigCaller(owner) | ||
bid = boards2.CreateBoard("test-board") | ||
tid = boards2.CreateThread(bid, "Foo", "bar") | ||
rid = boards2.CreateReply(bid, tid, 0, "body") | ||
|
||
// Invite a member using a role with permission to flag replies | ||
boards2.InviteMember(bid, moderator, boards2.RoleModerator) | ||
std.TestSetOrigCaller(moderator) | ||
} | ||
|
||
func main() { | ||
boards2.FlagReply(bid, tid, rid, "") | ||
|
||
// Render content must contain a message about the hidden reply | ||
content := boards2.Render("test-board/1/2") | ||
println(strings.Contains(content, "\n> _Reply is hidden as it has been flagged as inappropriate_\n")) | ||
} | ||
|
||
// Output: | ||
// true |