testutil

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//go:embed testdata/scripts.js
	GlobalScript string
	//go:embed testdata/task.yaml
	TaskSchema string
	//go:embed testdata/user.yaml
	UserSchema string
	//go:embed testdata/account.yaml
	AccountSchema  string
	AllCollections = []string{AccountSchema, UserSchema, TaskSchema}
)

Functions

func NewTaskDoc

func NewTaskDoc(usrID string) *myjson.Document

func NewUserDoc

func NewUserDoc() *myjson.Document

func Seed added in v0.3.9

func Seed(ctx context.Context, db myjson.Database, accounts int, usersPerAccount int, tasksPerUser int) error

func SeedUsers added in v0.3.3

func SeedUsers(ctx context.Context, db myjson.Database, perAccount int, tasksPerUser int) error

func Test added in v0.3.9

func Test(t *testing.T, cfg TestConfig, fn TestFunc) func(*testing.T)

func TestDB

func TestDB(fn func(ctx context.Context, db myjson.Database), opts ...myjson.DBOpt) error

Types

type TestConfig added in v0.3.9

type TestConfig struct {
	Opts        []myjson.DBOpt
	Persist     bool
	Collections []string
	Values      string
	Roles       []string
	Timeout     time.Duration
}

type TestFunc added in v0.3.9

type TestFunc func(ctx context.Context, t *testing.T, db myjson.Database)

Jump to

Keyboard shortcuts

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