z_1_c_filetest.gno
0.82 Kb ยท 38 lines
1package main
2
3import (
4 "std"
5 "testing"
6
7 boards2 "gno.land/r/gnoland/boards2/v1"
8)
9
10const (
11 owner = std.Address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
12 admin = std.Address("g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj") // @test2
13 user = std.Address("g1w4ek2u33ta047h6lta047h6lta047h6ldvdwpn")
14 role = boards2.RoleAdmin
15)
16
17var bid boards2.BoardID // Operate on board DAO
18
19func init() {
20 testing.SetRealm(std.NewUserRealm(owner))
21 bid = boards2.CreateBoard(cross, "test123", false)
22
23 // Add an admin member
24 boards2.InviteMember(cross, bid, admin, boards2.RoleAdmin)
25}
26
27func main() {
28 // Next call will be done by the admin member
29 testing.SetRealm(std.NewUserRealm(admin))
30
31 boards2.InviteMember(cross, bid, user, role)
32
33 // Check that user is invited
34 println(boards2.HasMemberRole(bid, user, role))
35}
36
37// Output:
38// true