tests

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertHTTPErrorCode

func AssertHTTPErrorCode(t *testing.T, err error, code int)

AssertHTTPErrorCode asserts an HTTP status code on a given Echo HTTP error

func CreateTestContainerPostgresDB

func CreateTestContainerPostgresDB(t *testing.T) (*sql.DB, string, context.Context)

CreateTestContainerPostgresDB returns a migration-ready DB handle for integration tests.

func ExecuteMiddleware

func ExecuteMiddleware(ctx echo.Context, mw echo.MiddlewareFunc) error

ExecuteMiddleware executes a middleware function on a given Echo context

func InitSession

func InitSession(ctx echo.Context)

InitSession initializes a session for a given Echo context

func LinkFriendsDB

func LinkFriendsDB(ctx context.Context, db *sql.DB, profileID int, matchIDs []int) error

LinkFriendsDB links a profile to friend profile IDs through SQL.

func NewContext

func NewContext(e *echo.Echo, url string) (echo.Context, *httptest.ResponseRecorder)

NewContext creates a new Echo context for tests using an HTTP test request and response recorder

Types

type UserRecord

type UserRecord struct {
	ID       int
	Name     string
	Email    string
	Password string
	Verified bool
}

func CreateRandomUserDB

func CreateRandomUserDB(db *sql.DB) (*UserRecord, error)

CreateRandomUserDB creates a random user through SQL for DB-first tests.

func CreateUserDB

func CreateUserDB(ctx context.Context, db *sql.DB, name, email, password string, verified bool) (*UserRecord, error)

CreateUserDB creates a user through SQL and returns a lightweight record.

Jump to

Keyboard shortcuts

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