Skip to content

Commit

Permalink
feat: add flag threshold test
Browse files Browse the repository at this point in the history
  • Loading branch information
x1unix committed Dec 19, 2024
1 parent 4505b95 commit 0890405
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/gno.land/r/demo/boards2/z_2_a_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func main() {
bid := boards2.CreateBoard("test1")
pid := boards2.CreateThread(bid, "thread", "thread")
boards2.FlagThread(bid, pid, "reason")
rid := boards2.CreateReply(bid, pid, pid, "reply")
_ = boards2.CreateReply(bid, pid, pid, "reply")
}

// Error:
Expand Down
25 changes: 25 additions & 0 deletions examples/gno.land/r/demo/boards2/z_2_d_filetest.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package main

import (
"std"

"gno.land/r/demo/boards2"
)

const owner = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1

func init() {
std.TestSetOrigCaller(owner)
}

func main() {
// Only single user per flag can't be tested atm, as flagThreshold = 1.
bid := boards2.CreateBoard("test1")
pid := boards2.CreateThread(bid, "thread", "thread")

boards2.FlagThread(bid, pid, "reason1")
boards2.FlagThread(bid, pid, "reason2")
}

// Error:
// item flag count threshold exceeded: 1

0 comments on commit 0890405

Please sign in to comment.