Documentation
¶
Overview ¶
Package dbtest provides shared test helpers for database setup and session seeding across test packages.
Index ¶
- func AsstMsg(sid string, ordinal int, content string) db.Message
- func OpenTestDB(t *testing.T) *db.DB
- func Ptr[T any](v T) *T
- func SeedMessages(t *testing.T, d *db.DB, msgs ...db.Message)
- func SeedSession(t *testing.T, d *db.DB, id, project string, opts ...func(*db.Session))
- func UserMsg(sid string, ordinal int, content string) db.Message
- func WriteTestFile(t *testing.T, path string, content []byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenTestDB ¶
OpenTestDB creates a temporary SQLite database for testing. The database is automatically closed when the test completes.
func SeedMessages ¶
SeedMessages inserts messages into the database, failing the test on error.
func SeedSession ¶
SeedSession creates and upserts a session with sensible defaults. Override any field via the opts functions.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.