testutils

package
v0.5.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: PostgreSQL Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger(t testing.TB) zerolog.Logger

Types

type GoldenTest

type GoldenTest[T any] struct {
	// FileExtension defaults to '.json'.
	FileExtension string
	// Marshal defaults to a wrapper around json.MarshalIndent
	Marshal func(v any) ([]byte, error)
	// Unmarshal defaults to json.Unmarshal
	Unmarshal func(data []byte, v any) error
	// Compare defaults to require.Compare
	Compare func(t testing.TB, expected, actual T)
}

GoldenTest is a helper for "golden tests," which compare an actual output to a known good output that's saved to a file and committed to the repository.

func (*GoldenTest[T]) Run

func (g *GoldenTest[T]) Run(t testing.TB, actual T, update bool)

Jump to

Keyboard shortcuts

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