testkit

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActorTemporalScenario

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

ActorTemporalScenario wraps TemporalScenario for actor descriptions.

func NewActorTemporalScenario

func NewActorTemporalScenario(actor actors.Actor, id string, init any) *ActorTemporalScenario

NewActorTemporalScenario constructs a TemporalScenario backed by the given actor.

func (*ActorTemporalScenario) Advance

Advance advances the Temporal clock.

func (*ActorTemporalScenario) Env

Env exposes the underlying TemporalScenario environment for additional setup.

func (*ActorTemporalScenario) ExpectActivityOptions

func (s *ActorTemporalScenario) ExpectActivityOptions(name string, assert func(testing.TB, actors.ActivityCallOptions)) *ActorTemporalScenario

ExpectActivityOptions asserts the merged Temporal options for an activity name.

func (*ActorTemporalScenario) ExpectActivityOptionsForPayload

func (s *ActorTemporalScenario) ExpectActivityOptionsForPayload(payload any, assert func(testing.TB, actors.ActivityCallOptions)) *ActorTemporalScenario

ExpectActivityOptionsForPayload asserts merged options using the payload type to resolve the activity name.

func (*ActorTemporalScenario) QueryWorkflow

func (s *ActorTemporalScenario) QueryWorkflow(payload any) (converter.EncodedValue, error)

QueryWorkflow executes a typed query against the workflow.

func (*ActorTemporalScenario) Run

Run executes the scenario.

func (*ActorTemporalScenario) Then

Then registers assertions.

func (*ActorTemporalScenario) WhenActivity

func (s *ActorTemporalScenario) WhenActivity(nameOrFn interface{}, fnOpt ...interface{}) *ActorTemporalScenario

WhenActivity overrides a registered activity. Accepts either (name, fn) or a typed func(context.Context, Payload) to infer the name from the payload type.

func (*ActorTemporalScenario) WhenActivityForPayload

func (s *ActorTemporalScenario) WhenActivityForPayload(payload any, fn interface{}) *ActorTemporalScenario

WhenActivityForPayload overrides an activity by inferred payload type.

func (*ActorTemporalScenario) WhenCommand

func (s *ActorTemporalScenario) WhenCommand(payload any) *ActorTemporalScenario

WhenCommand sends a typed command to the workflow.

type TemporalAssertion

type TemporalAssertion func(testing.TB, TemporalOutcome)

TemporalAssertion inspects the workflow outcome.

type TemporalOutcome

type TemporalOutcome struct {
	Env   *testsuite.TestWorkflowEnvironment
	Error error
}

TemporalOutcome captures workflow execution artifacts for assertions.

type TemporalScenario

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

TemporalScenario orchestrates a real Temporal workflow inside the Temporal testsuite environment using a declarative step API.

func NewTemporalScenario

func NewTemporalScenario(wf interface{}, args ...any) *TemporalScenario

NewTemporalScenario constructs a scenario for the provided workflow.

func NewTemporalScenarioWithOptions

func NewTemporalScenarioWithOptions(workflowFn interface{}, opts workflow.RegisterOptions, args ...any) *TemporalScenario

NewTemporalScenarioWithOptions registers the workflow using Temporal register options.

func (*TemporalScenario) Advance

Advance moves the fake clock forward deterministically.

func (*TemporalScenario) Env

Env exposes the underlying TestWorkflowEnvironment for additional setup.

func (*TemporalScenario) Run

Run executes the scenario and returns the outcome.

func (*TemporalScenario) Then

Then registers assertions executed after workflow completion.

func (*TemporalScenario) When

func (s *TemporalScenario) When(name string, payload any) *TemporalScenario

When schedules a signal (command) delivery.

Jump to

Keyboard shortcuts

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