testutil

package
v0.0.0-...-2076d20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2026 License: Apache-2.0, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConsoleLogCommand, _ = command.Parse("/console/log")

logs a message to the console

View Source
var TestEchoCommand, _ = command.Parse("/test/echo")

echos the arguments back to the caller

Functions

func ArgsMap

func ArgsMap(t *testing.T, inv ucan.Invocation) datamodel.Map

ArgsMap decodes an invocation's args bytes into a generic datamodel.Map. Test convenience for echo handlers and ad-hoc key access; production code should decode ArgumentsBytes directly into a typed cborgen struct.

func Must

func Must[T any](val T, err error) func(t *testing.T) T

Must takes return values from a function and returns the non-error one. If the error value is non-nil then it panics.

func RandomArgs

func RandomArgs(t *testing.T) *hdm.TestArgs

RandomArgs returns a populated *hdm.TestArgs. It implements [cbg.CBORMarshaler] (and the dag-json equivalent) and can be passed directly to invocation.Invoke or marshalled into envelope bytes.

func RandomBytes

func RandomBytes(t *testing.T, size int) []byte

func RandomCID

func RandomCID(t *testing.T) cid.Cid

func RandomDID

func RandomDID(t *testing.T) did.DID

func RandomDigest

func RandomDigest(t *testing.T) multihash.Multihash

func RandomSigner

func RandomSigner(t *testing.T) principal.Signer

func ResultMap

func ResultMap(t *testing.T, raw []byte) ipld.Map

ResultMap decodes raw CBOR bytes (e.g. from a Receipt.Out() branch) into a generic ipld.Map. Returns nil if raw is empty.

Types

This section is empty.

Directories

Path Synopsis
gen command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL