test_helpers

package
v0.0.0-...-ecad64e Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureOutput

func CaptureOutput() (*bytes.Buffer, func())

CaptureOutput redirects the log output to a buffer and returns a function to restore the original state and the buffer.

func NewMockGameResultDAO

func NewMockGameResultDAO() *mockGameResultDAO

NewMockGameResultDAO creates a new instance of MockManager

Types

type MockQuerier

type MockQuerier struct {
	mock.Mock
	// contains filtered or unexported fields
}

MockQuerier is a mock type for the Querier type

func NewMockQuerier

func NewMockQuerier() *MockQuerier

NewMockQuerier creates a new instance of MockQuerier

func (*MockQuerier) CheckTransactionID

func (m *MockQuerier) CheckTransactionID(ctx context.Context, transactionId string) (bool, error)

func (*MockQuerier) Close

func (m *MockQuerier) Close()

func (*MockQuerier) GameCount

func (m *MockQuerier) GameCount() int

func (*MockQuerier) GameResultExists

func (m *MockQuerier) GameResultExists(ctx context.Context, transactionId string) (bool, error)

func (*MockQuerier) InsertGameResult

func (m *MockQuerier) InsertGameResult(ctx context.Context, txn sqlx.Tx, gameResult entity.GameResult) (int, error)

func (*MockQuerier) LockUserRow

func (m *MockQuerier) LockUserRow(ctx context.Context, txn sqlx.Tx, userId uuid.UUID) error

func (*MockQuerier) SelectGameResultsByUser

func (m *MockQuerier) SelectGameResultsByUser(ctx context.Context, userId uuid.UUID, validationStatus entity.ValidationStatus) ([]entity.GameResult, error)

func (*MockQuerier) SelectUser

func (m *MockQuerier) SelectUser(ctx context.Context, userId uuid.UUID) (*entity.User, error)

func (*MockQuerier) SelectUsersByValidationStatus

func (m *MockQuerier) SelectUsersByValidationStatus(ctx context.Context, validationStatus bool) ([]entity.User, error)

func (*MockQuerier) UpdateGameResult

func (m *MockQuerier) UpdateGameResult(ctx context.Context, txn sqlx.Tx, gameResultId int, validationStatus entity.ValidationStatus) error

func (*MockQuerier) UpdateUserBalance

func (m *MockQuerier) UpdateUserBalance(ctx context.Context, txn sqlx.Tx, userId uuid.UUID, balance float64, validationStatus bool) error

func (*MockQuerier) WithTransaction

func (m *MockQuerier) WithTransaction(ctx context.Context, fn func(*sqlx.Tx) error) (err error)

type TestDatabase

type TestDatabase struct {
	// contains filtered or unexported fields
}

func NewTestDatabase

func NewTestDatabase(t *testing.T) *TestDatabase

func (*TestDatabase) Close

func (db *TestDatabase) Close(t *testing.T)

func (*TestDatabase) ConnectionString

func (db *TestDatabase) ConnectionString(t *testing.T) string

func (*TestDatabase) IsRunning

func (db *TestDatabase) IsRunning(t *testing.T) bool

func (*TestDatabase) Port

func (db *TestDatabase) Port(t *testing.T) int

Jump to

Keyboard shortcuts

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