boltztest

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create[E boltz.Entity](ctx TestContext, entity E) error

func Delete

func Delete[E boltz.Entity](ctx TestContext, entity E) error

func GetStoreForEntity

func GetStoreForEntity[E boltz.Entity](ctx TestContext, entity E) boltz.EntityStore[E]

func Patch

func Patch[E boltz.Entity](ctx TestContext, entity E, checker boltz.FieldChecker) error

func Reload

func Reload[E boltz.Entity](ctx TestContext, entity E) error

func RequireCreate

func RequireCreate[E boltz.Entity](ctx TestContext, entity E)

func RequireDelete

func RequireDelete[E boltz.Entity](ctx TestContext, entity E, ignorePaths ...string)

func RequirePatch

func RequirePatch[E boltz.Entity](ctx TestContext, entity E, checker boltz.FieldChecker)

func RequireReload

func RequireReload[E boltz.Entity](ctx TestContext, entity E)

func RequireUpdate

func RequireUpdate[E boltz.Entity](ctx TestContext, entity E)

func Update

func Update[E boltz.Entity](ctx TestContext, entity E) error

func ValidateBaseline

func ValidateBaseline[E boltz.ExtEntity](ctx TestContext, entity E, opts ...cmp.Option)

func ValidateDeleted

func ValidateDeleted(ctx TestContext, id string, ignorePaths ...string)

func ValidateUpdated

func ValidateUpdated[E boltz.ExtEntity](ctx TestContext, entity E)

Types

type BaseTestContext

type BaseTestContext struct {
	require.Assertions

	ReferenceTime time.Time
	// contains filtered or unexported fields
}

func NewTestContext

func NewTestContext(t testing.TB, storeF StoreFunc) *BaseTestContext

func (*BaseTestContext) Cleanup

func (ctx *BaseTestContext) Cleanup()

func (*BaseTestContext) CreateTags

func (ctx *BaseTestContext) CreateTags() map[string]interface{}

func (*BaseTestContext) GetDb

func (ctx *BaseTestContext) GetDb() boltz.Db

func (*BaseTestContext) GetDbFile

func (ctx *BaseTestContext) GetDbFile() *os.File

func (*BaseTestContext) GetReferenceTime

func (ctx *BaseTestContext) GetReferenceTime() time.Time

func (*BaseTestContext) GetRelatedIds

func (ctx *BaseTestContext) GetRelatedIds(entity boltz.Entity, field string) []string

func (*BaseTestContext) GetStoreForEntity

func (ctx *BaseTestContext) GetStoreForEntity(entity boltz.Entity) boltz.Store

func (*BaseTestContext) InitDb

func (ctx *BaseTestContext) InitDb(openF func(name string) (boltz.Db, error))

func (*BaseTestContext) NextTest

func (ctx *BaseTestContext) NextTest(t *testing.T)

func (*BaseTestContext) Require

func (ctx *BaseTestContext) Require() *require.Assertions

type StoreFunc

type StoreFunc func(entity boltz.Entity) boltz.Store

type TestContext

type TestContext interface {
	GetDb() boltz.Db
	GetStoreForEntity(entity boltz.Entity) boltz.Store
	NextTest(t *testing.T)
	Require() *require.Assertions
	GetReferenceTime() time.Time
}

Jump to

Keyboard shortcuts

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