test

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthInjectorTestHandler

func AuthInjectorTestHandler(userID string) fiber.Handler

AuthInjectorTestHandler injects fake jwt with sub

func BuildRequest

func BuildRequest(method, url, body string) *http.Request

func ErrorHandler

func ErrorHandler(c *fiber.Ctx, err error, logger *zerolog.Logger, isProduction bool) error

ErrorHandler custom handler to log recovered errors using our logger and return json instead of string

func Logger

func Logger() *zerolog.Logger

func SetupAppFiber

func SetupAppFiber(logger zerolog.Logger) *fiber.App

SetupAppFiber sets up app fiber with defaults for testing, like our production error handler.

func StartContainerDatabase

func StartContainerDatabase(ctx context.Context, t *testing.T, migrationsDirRelPath string) (db.Store, testcontainers.Container)

StartContainerDatabase starts postgres container with default test settings, and migrates the db. Caller must terminate container.

func TruncateTables

func TruncateTables(db *sql.DB, t *testing.T)

TruncateTables truncates tables for the test db, useful to run as teardown at end of each DB dependent test.

Types

type UsersClient

type UsersClient struct {
	Store map[string]*pb.User
}

func (*UsersClient) GetUser

func (c *UsersClient) GetUser(_ context.Context, in *pb.GetUserRequest, _ ...grpc.CallOption) (*pb.User, error)

Jump to

Keyboard shortcuts

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