testutils

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DbName = "test_db"
	DbUser = "test_user"
	DbPass = "test_password"
)

Variables

View Source
var TestAssets embed.FS

Functions

func ArrayToPool

func ArrayToPool(array []string)

func GenerateDBAuthor

func GenerateDBAuthor() db.AuthorDB

func GetTestAssets

func GetTestAssets() embed.FS

Types

type TestContainerConfiguration

type TestContainerConfiguration struct {
	Container *testcontainers.DockerContainer
	Host      string
	Port      string
	Username  string
	Password  string
	Database  string
}

func PrepareMySQLDB

func PrepareMySQLDB() (*TestContainerConfiguration, error)

func PreparePostgresDB

func PreparePostgresDB() (*TestContainerConfiguration, error)

type TestDBHandler

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

func NewTestDBHandler

func NewTestDBHandler(t *testing.T) *TestDBHandler

func (*TestDBHandler) AddTests

func (test *TestDBHandler) AddTests(testConfs ...TestRunConfig)

func (*TestDBHandler) InitMySQL

func (test *TestDBHandler) InitMySQL() *db.MysqlDB

func (*TestDBHandler) InitPostgres

func (test *TestDBHandler) InitPostgres() *db.PostgresDB

func (*TestDBHandler) StartTestDBHandler

func (test *TestDBHandler) StartTestDBHandler()

func (*TestDBHandler) TestRun

func (test *TestDBHandler) TestRun(
	t *testing.T,
	testRun TestRunConfig,
	newDS func() db.DataStore,
)

type TestDataStore

type TestDataStore struct {
	DS                  db.DataStore
	Logger              *zap.SugaredLogger
	Hooks               *hooks2.Hook
	ReadOnlyManager     *pad.ReadOnlyManager
	SecurityManager     *pad.SecurityManager
	AuthorManager       *author.Manager
	PadManager          *pad.Manager
	PadMessageHandler   *ws.PadMessageHandler
	AdminMessageHandler *ws.AdminMessageHandler
	MockWebSocket       *ws.MockWebSocketConn
	Validator           *validator.Validate
	Hub                 *ws.Hub
	App                 *fiber.App
	PrivateAPI          fiber.Router
}

func (*TestDataStore) ToInitStore

func (t *TestDataStore) ToInitStore() *lib.InitStore

type TestRunConfig

type TestRunConfig struct {
	Name string
	Test func(t *testing.T, tsStore TestDataStore)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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