ftltest

package
v0.189.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package ftltest contains test utilities for the ftl package.

Index

Constants

View Source
const (
	DBTypePostgres = DBType(modulecontext.DBTypePostgres)
)

Variables

This section is empty.

Functions

func Context

func Context(options ...func(context.Context) error) context.Context

Context suitable for use in testing FTL verbs with provided options

func WhenVerb added in v0.189.0

func WhenVerb[Req any, Resp any](verb ftl.Verb[Req, Resp], fake func(ctx context.Context, req Req) (resp Resp, err error)) func(context.Context) error

WhenVerb replaces an implementation for a verb

To be used when setting up a context for a test: ctx := ftltest.Context(

ftltest.WhenVerb(Example.Verb, func(ctx context.Context, req Example.Req) (Example.Resp, error) {
    ...
}),
... other options

)

func WithConfig added in v0.189.0

func WithConfig(name string, value any) func(context.Context) error

WithConfig sets a configuration for the current module

To be used with Context(...)

func WithDSN added in v0.189.0

func WithDSN(name string, dbType DBType, dsn string) func(context.Context) error

WithDSN sets a DSN for the current module

To be used with Context(...)

func WithSecret added in v0.189.0

func WithSecret(name string, value any) func(context.Context) error

WithSecret sets a secret for the current module

To be used with Context(...)

Types

type DBType added in v0.189.0

type DBType int32

Jump to

Keyboard shortcuts

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