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

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

cask_test.gno

0.74 Kb · 24 lines
 1package cask
 2
 3import (
 4	"testing"
 5
 6	"gno.land/p/nt/uassert/v0"
 7)
 8
 9const ash = address("g1zkzjmyveh7euq83h5zhnhj6mg0d7kr35nphzd2")
10
11func TestNewGuestHasAPurse(t *testing.T) {
12	shillings, casks := Holdings(ash)
13	uassert.Equal(t, purse, shillings)
14	uassert.Equal(t, int64(0), casks)
15}
16
17func TestHonestPurchasesFail(cur realm, t *testing.T) {
18	testing.SetRealm(testing.NewUserRealm(ash))
19	uassert.AbortsContains(t, cur, "cannot afford", func() { Buy(cross(cur), 1) })
20	uassert.AbortsContains(t, cur, "cannot afford", func() { Buy(cross(cur), goal) })
21	uassert.AbortsContains(t, cur, "at least one", func() { Buy(cross(cur), 0) })
22	uassert.AbortsContains(t, cur, "at least one", func() { Buy(cross(cur), -goal) })
23	uassert.False(t, captures.Captured(ash))
24}