testutils

package
v0.0.0-...-f4289e1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertError

func AssertError(t testing.TB, err error, expected string)

func AssertErrorAndCode

func AssertErrorAndCode(t testing.TB, err error, code string, msg string)

func AssertErrorCode

func AssertErrorCode(t testing.TB, err error, expected string)

func BudgetAuthContext

func BudgetAuthContext(t testing.TB, userID beans.ID, budget beans.Budget) *beans.BudgetAuthContext

func CmpAccount

func CmpAccount(a beans.Account, b beans.Account) bool

func CmpCategory

func CmpCategory(a beans.Category, b beans.Category) bool

func CmpCategoryGroup

func CmpCategoryGroup(a beans.CategoryGroup, b beans.CategoryGroup) bool

func IsEqualInAnyOrder

func IsEqualInAnyOrder[T any](tb testing.TB, sliceA []T, sliceB []T, comp func(a, b T) bool)

func MustRollback

func MustRollback(t testing.TB, tx beans.Tx)

func NewDate

func NewDate(t testing.TB, date string) beans.Date

func NewEmptyID

func NewEmptyID() beans.ID

func NewMonthDate

func NewMonthDate(t testing.TB, date string) beans.MonthDate

func RandomTime

func RandomTime() time.Time

func TmpDatasource

func TmpDatasource(tb testing.TB) (beans.DataSource, func())

Types

type Factory

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

func NewFactory

func NewFactory(tb testing.TB, ds beans.DataSource) *Factory

func (*Factory) Account

func (f *Factory) Account(account beans.Account) beans.Account

func (*Factory) Category

func (f *Factory) Category(category beans.Category) beans.Category

func (*Factory) CategoryGroup

func (f *Factory) CategoryGroup(categoryGroup beans.CategoryGroup) beans.CategoryGroup

func (*Factory) MakeBudget

func (f *Factory) MakeBudget(name string, userID beans.ID) beans.Budget

func (*Factory) MakeBudgetAndUser

func (f *Factory) MakeBudgetAndUser() (beans.Budget, beans.User)

func (*Factory) MakeCategory

func (f *Factory) MakeCategory(name string, groupID beans.ID, budgetID beans.ID) beans.Category

func (*Factory) MakeCategoryGroup

func (f *Factory) MakeCategoryGroup(name string, budgetID beans.ID) beans.CategoryGroup

func (*Factory) MakeIncomeCategoryGroup

func (f *Factory) MakeIncomeCategoryGroup(name string, budgetID beans.ID) beans.CategoryGroup

func (*Factory) MakeMonth

func (f *Factory) MakeMonth(budgetID beans.ID, date beans.Date) beans.Month

func (*Factory) MakeMonthCategory

func (f *Factory) MakeMonthCategory(monthID beans.ID, categoryID beans.ID, amount beans.Amount) beans.MonthCategory

func (*Factory) MakePayee

func (f *Factory) MakePayee(name string, budgetID beans.ID) beans.Payee

func (*Factory) MakeUser

func (f *Factory) MakeUser(username string) beans.ID

func (*Factory) Month

func (f *Factory) Month(month beans.Month) beans.Month

func (*Factory) MonthCategory

func (f *Factory) MonthCategory(budgetID beans.ID, monthCategory beans.MonthCategory) beans.MonthCategory

func (*Factory) Payee

func (f *Factory) Payee(payee beans.Payee) beans.Payee

func (*Factory) Transaction

func (f *Factory) Transaction(budgetID beans.ID, transaction beans.Transaction) beans.Transaction

func (*Factory) Transfer

func (f *Factory) Transfer(budgetID beans.ID, accountA beans.Account, accountB beans.Account, amount beans.Amount) []beans.Transaction

func (*Factory) User

func (f *Factory) User(user beans.User) beans.User

Jump to

Keyboard shortcuts

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