diff --git a/examples/gno.land/r/nt/boards2/z_0_g_filetest.gno b/examples/gno.land/r/nt/boards2/z_0_g_filetest.gno new file mode 100644 index 00000000000..c835a5877ac --- /dev/null +++ b/examples/gno.land/r/nt/boards2/z_0_g_filetest.gno @@ -0,0 +1,20 @@ +package main + +import ( + "std" + + "gno.land/r/nt/boards2" +) + +const owner = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1 + +func init() { + std.TestSetOrigCaller(owner) +} + +func main() { + boards2.CreateBoard("short") +} + +// Error: +// the minimum allowed board name length is 6 characters diff --git a/examples/gno.land/r/nt/boards2/z_0_h_filetest.gno b/examples/gno.land/r/nt/boards2/z_0_h_filetest.gno new file mode 100644 index 00000000000..89da0a08dac --- /dev/null +++ b/examples/gno.land/r/nt/boards2/z_0_h_filetest.gno @@ -0,0 +1,34 @@ +package main + +// SEND: 200000000ugnot + +import ( + "std" + + "gno.land/r/demo/users" + "gno.land/r/nt/boards2" +) + +const ( + owner = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1 + member = std.Address("g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj") // @test2 + name = "test123" +) + +func init() { + std.TestSetOrigCaller(owner) + + // Test1 is the boards owner and its address has a user already registered + // so a new member must register a user with the new board name. + boards2.InviteMember(0, member, boards2.RoleOwner) // Operate on realm DAO members instead of individual boards + std.TestSetOrigCaller(member) + users.Register("", name, "") +} + +func main() { + bid := boards2.CreateBoard(name) + println("ID =", bid) +} + +// Output: +// ID = 1 diff --git a/examples/gno.land/r/nt/boards2/z_0_i_filetest.gno b/examples/gno.land/r/nt/boards2/z_0_i_filetest.gno new file mode 100644 index 00000000000..c54a7e8c1d0 --- /dev/null +++ b/examples/gno.land/r/nt/boards2/z_0_i_filetest.gno @@ -0,0 +1,20 @@ +package main + +import ( + "std" + + "gno.land/r/nt/boards2" +) + +const owner = std.Address("g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj") // @test2 + +func init() { + std.TestSetOrigCaller(owner) +} + +func main() { + boards2.CreateBoard("test123") +} + +// Error: +// unauthorized