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