rack_test.gno
0.85 Kb · 27 lines
1package rack
2
3import (
4 "testing"
5
6 "gno.land/p/nt/uassert/v0"
7)
8
9const ash = address("g1zkzjmyveh7euq83h5zhnhj6mg0d7kr35nphzd2")
10
11func TestOnlyKeeperReserves(cur realm, t *testing.T) {
12 testing.SetRealm(testing.NewUserRealm(ash))
13 uassert.AbortsContains(t, cur, "only the keeper", func() { Reserve(cross(cur), ash, Prize) })
14}
15
16func TestKeeperNeverReservesThePrize(cur realm, t *testing.T) {
17 testing.SetRealm(testing.NewUserRealm(Ledger.Keeper))
18 uassert.AbortsContains(t, cur, "would never", func() { Reserve(cross(cur), ash, Prize) })
19}
20
21func TestOrdinaryBottleIsNotTheFlag(cur realm, t *testing.T) {
22 testing.SetRealm(testing.NewUserRealm(Ledger.Keeper))
23 Reserve(cross(cur), ash, "1990 Barolo")
24 testing.SetRealm(testing.NewUserRealm(ash))
25 uassert.AbortsContains(t, cur, "not the flag", func() { Collect(cross(cur)) })
26 uassert.False(t, captures.Captured(ash))
27}