Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(boards2): add missing filetests for board ID getter by name #3642

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions examples/gno.land/r/nt/boards2/public.gno
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,6 @@ func assertIsUserCall() {
}
}

func assertHasPermission(user std.Address, p Permission) {
if !gPerm.HasPermission(user, p) {
panic("unauthorized")
}
}

func assertHasBoardPermission(b *Board, user std.Address, p Permission) {
if !b.perms.HasPermission(user, p) {
panic("unauthorized")
Expand Down
29 changes: 29 additions & 0 deletions examples/gno.land/r/nt/boards2/z_7_a_filetest.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package main

import (
"std"

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

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

var bid boards2.BoardID

func init() {
std.TestSetOrigCaller(owner)
bid = boards2.CreateBoard(name)
}

func main() {
bid2, found := boards2.GetBoardIDFromName(name)
println(found)
println(bid2 == bid)
}

// Output:
// true
// true
23 changes: 23 additions & 0 deletions examples/gno.land/r/nt/boards2/z_7_b_filetest.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package main

import (
"std"

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

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

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

func main() {
bid, found := boards2.GetBoardIDFromName("foobar")
println(found)
println(bid == 0)
}

// Output:
// false
// true
Loading