Documentation ¶
Overview ¶
Package tutil provides test utilities.
Index ¶
- func PrepRPCTestConfig(t *testing.T) *config.Config
- func RandomBytes(l int) []byte
- func RandomHash() common.Hash
- func RequireGoldenBytes(t *testing.T, data []byte, opts ...func(*string))
- func RequireGoldenJSON(t *testing.T, data any, opts ...func(*string))
- func RequireNoError(tb testing.TB, err error)
- func TempDir(t *testing.T) string
- func WithFilename(name string) func(*string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrepRPCTestConfig ¶
PrepRPCTestConfig creates the require cometbft config on disk for rpctest package to work with story app.
func RandomBytes ¶
RandomBytes returns a random byte slice of length l.
func RequireGoldenBytes ¶
RequireGoldenBytes asserts that a golden testdata file exists containing the exact data. This is heavily inspired from https://github.com/sebdah/goldie.
func RequireGoldenJSON ¶
RequireGoldenJSON asserts that a golden testdata file exists containing the JSON serialized form of the data object. This is heavily inspired from https://github.com/sebdah/goldie.
func RequireNoError ¶
RequireNoError asserts that err is nil. It also logs the error to show the stacktrace.
This can be used instead of require.NoError(t, err) to show the stacktrace in case of error.
func TempDir ¶
TempDir creates a temporary directory with a random name, as opposed to t.TempDir which uses consecutive numbers per test (001, 002 ...).
func WithFilename ¶
WithFilename configures a custom golden test filename.
Types ¶
This section is empty.