Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_rename_board_00_filetest.gno

0.80 Kb · 37 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v1/filetests/z_rename_board_00_filetest
 2
 3package z_rename_board_00_filetest
 4
 5import (
 6	"testing"
 7
 8	"gno.land/p/gnoland/boards"
 9
10	boards2 "gno.land/r/gnoland/boards2/v1"
11)
12
13const (
14	owner   address = "g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh"
15	name            = "foo123"
16	newName         = "bar123"
17)
18
19var bid boards.ID // Operate on board DAO
20
21func init(cur realm) {
22	testing.SetRealm(testing.NewUserRealm(owner))
23	bid = boards2.CreateBoard(cross(cur), name, false, false)
24}
25
26func main(cur realm) {
27	testing.SetRealm(testing.NewUserRealm(owner))
28
29	boards2.RenameBoard(cross(cur), name, newName)
30
31	// Ensure board is renamed by the default board owner
32	bid2, _ := boards2.GetBoardIDFromName(cross(cur), newName)
33	println("IDs match =", bid == bid2)
34}
35
36// Output:
37// IDs match = true