export_test.gno
0.71 Kb · 26 lines
1package home
2
3import (
4 "gno.land/p/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/upgradeable/v0"
5 "gno.land/p/nt/avl/v0"
6)
7
8// Test hooks. Realm globals live for the whole test binary, so every test
9// that reads Render or Manifest starts from a known tree and a fresh proxy.
10
11// ResetForTest clears all realm state.
12func ResetForTest() {
13 slots = avl.NewTree()
14 rev = 0
15 lastHeight = 0
16 proxy = upgradeable.New(upgradeable.NewAddrAuthority(Admin))
17}
18
19// SeedForTest writes a slot without the authority check.
20func SeedForTest(slug, body string) {
21 rev++
22 slots.Set(slug, &Slot{Body: body, Rev: rev, Height: 0})
23}
24
25// ReservedSlugsForTest exposes the reserved names.
26func ReservedSlugsForTest() []string { return reservedSlugs }