Documentation
¶
Overview ¶
Package testutil provides shared test helpers for ingitdb-cli tests.
The package contains no production code. It is intentionally placed under `internal/` so it can only be imported by other packages in this module, and its functions accept `*testing.T` so they can only be called from test code.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var NestedListItems = []NestedListItem{
{List: "to-buy", ID: "milk", Title: "Milk", AddedAt: "2026-09-17T10:00:00Z"},
{List: "to-buy", ID: "bananas", Title: "Bananas", AddedAt: "2026-09-17T10:00:01Z"},
{List: "to-buy", ID: "coffee", Title: "Coffee", AddedAt: "2026-09-17T10:00:02Z"},
{List: "to-watch", ID: "the-matrix", Title: "The Matrix", AddedAt: "2026-09-17T10:00:03Z"},
{List: "to-watch", ID: "interstellar", Title: "Interstellar", AddedAt: "2026-09-17T10:00:04Z"},
}
NestedListItems are the item records WriteNestedListsDB writes, in the order they were added (ascending added_at).
Functions ¶
func MustErrContain ¶
MustErrContain asserts that err is non-nil and its message contains every substring in substrs. It reports failure via t.Fatalf. t.Helper() makes the failure point at the test that called MustErrContain rather than this line.
Example:
_, err := parseInput(badInput) testutil.MustErrContain(t, err, "$content", "collide")
func WriteDeepNestedListsDB ¶ added in v0.66.0
WriteDeepNestedListsDB writes the WriteNestedListsDB database plus a second subcollection level and an edge-case key: `items` declares subcollection `tags` (records `dairy` and `fresh` under item `milk`), and a list whose key equals the subcollection name, `lists/items`, has one item `self`.
func WriteNestedListsDB ¶ added in v0.66.0
WriteNestedListsDB creates, in a temporary directory, an inGitDB database shaped like the TODO demo: a root collection `lists` (records `to-buy` and `to-watch`) declaring a subcollection `items` (NestedListItems). Definitions are written as files; records are written through the local driver with parent keys, so they sit at the driver's own on-disk paths. It returns the database directory.