Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

z_rename_board_00_filetest.gno

0.80 Kb · 37 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v0/filetests/z_rename_board_00_filetest
 2
 3package z_rename_board_00_filetest
 4
 5import (
 6	"testing"
 7
 8	"gno.land/p/gnoland/boards/v0"
 9
10	boards2 "gno.land/r/gnoland/boards2/v0"
11)
12
13const (
14	owner   address = "g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx"
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