ledgertest

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ledgertest runs the shared store fixtures in lib/ledger/testdata/store/v1 against a store.Store implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dir

func Dir() (string, error)

Dir returns the fixture directory: $EXT_LEDGER_TESTDATA/store/v1, or testdata/store/v1 found by walking up from the working directory.

func Load

func Load(t testing.TB, name string, v any)

Load reads one fixture file into v.

func Match

func Match(want, actual any) bool

Match reports whether actual, a decoded JSON value, satisfies want, the expectation of a case. An object matches when each field it names matches, and a field absent from actual counts as null. A string in place of an object matches the object's "id". Two RFC 3339 strings match when they name the same instant. Null, false, 0, "" and [] match an absent value.

func Run

func Run(t *testing.T, b Backend)

Run runs every case in cases.json against b.

func RunBehaviour

func RunBehaviour(t *testing.T, b Backend)

RunBehaviour checks what the fixtures cannot hold: live watch delivery, a watch that overflows its buffer, concurrent writers, and a closed store.

func RunFingerprints

func RunFingerprints(t *testing.T, canonicalize func(store.Transaction) (json.RawMessage, string, error))

RunFingerprints checks a binding against the canonical transaction fixtures.

Types

type Backend

type Backend struct {
	// Open opens a store in dir with the options. Opening the same dir again
	// reopens the same store; a store that is not durable ignores dir.
	Open func(t testing.TB, dir string, options store.Options) store.Store
	// Durable stores also run the cases that reopen the store.
	Durable bool
}

Backend opens the store under test.

Jump to

Keyboard shortcuts

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