z_borrowed_render_filetest.gno
0.71 Kb · 25 lines
1// PKGPATH: gno.land/r/test/main
2//
3// Renders the registry from ANOTHER realm, which is the case a unit test in
4// the package cannot reach: there, CurrentRealm is the zones realm itself.
5// Here Render is borrowed, CurrentRealm is gno.land/r/test/main, and every
6// action link must still call the zones realm, not the one embedding it.
7package main
8
9import (
10 "strings"
11
12 zones "gno.land/r/moul/zones/v0"
13)
14
15func main() {
16 page := zones.Render("") + zones.Render("zone/onyx")
17 println(strings.Contains(page, "/r/moul/zones/v0$help&func=ProposeZone"))
18 println(strings.Contains(page, "/r/moul/zones/v0$help&func=RegisterEndpoint"))
19 println(strings.Contains(page, "/r/test/main$help"))
20}
21
22// Output:
23// true
24// true
25// false