Documentation
¶
Overview ¶
Package choktest provides test utilities for applications built on chok.
It eliminates the boilerplate of setting up in-memory databases, loggers, and stores that recurs in every test file. Typical usage:
func TestMyFeature(t *testing.T) {
gdb := choktest.NewTestDB(t, &model.User{}, &model.Post{})
s := store.New[model.Post](gdb, choktest.NopLogger())
// ... test against s ...
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTestDB ¶
NewTestDB opens an in-memory SQLite database, auto-migrates all provided models, and registers a cleanup that closes the DB when the test finishes. Fails the test on any error.
func NewTestStore ¶
NewTestStore creates a Store[T] backed by an in-memory SQLite DB with the model auto-migrated. This is the fastest path for unit- testing Store-backed business logic.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.