Documentation
¶
Overview ¶
Package testutil provides shared test helpers for all domain packages.
Index ¶
- func InsertUsers(t *testing.T, ctx context.Context, db interface{ ... }, userIDs ...string)
- func NewDB(t *testing.T) *sqlx.DB
- func NewDBWithUsers(t *testing.T, userIDs ...string) *sqlx.DB
- func WithRouteParams(ctx context.Context, params map[string]string) context.Context
- func WithUserContext(ctx context.Context, userID string) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InsertUsers ¶
func InsertUsers(t *testing.T, ctx context.Context, db interface { ExecContext(context.Context, string, ...any) (sql.Result, error) }, userIDs ...string)
InsertUsers seeds users with deterministic emails derived from their IDs.
func NewDB ¶
NewDB opens an in-memory SQLite database and runs all migrations. The database is closed automatically when the test ends.
func NewDBWithUsers ¶
NewDBWithUsers opens an in-memory SQLite database, runs migrations, and seeds users.
func WithRouteParams ¶
WithRouteParams attaches chi route params to the context for handler tests.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.