testdsl

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateTester

type AggregateTester func(given GivenFn, when WhenFn, then ThenFn)

AggregateTester defines an aggregate tester.

func Test

func Test(t *testing.T) AggregateTester

Test runs the test.

Example:

 Test(t)(
	  Given(agg),
	  When(testdata.TestCommand{Param: "param"}),
	  Then(testdata.TestEvent{Data: "param"}),
 )

type Checker

type Checker func(got []cqrs.DomainEvent, err error)

Checker asserts the given results.

type GivenFn

type GivenFn func() (cqrs.ESAggregate, []cqrs.DomainEvent)

GivenFn is a test init function.

func Given

func Given(agg cqrs.ESAggregate, events ...cqrs.DomainEvent) GivenFn

Given prepares the given aggregate for testing.

type ThenFn

type ThenFn func(t *testing.T) Checker

ThenFn prepares the Checker.

func Then

func Then(want ...cqrs.DomainEvent) ThenFn

Then asserts that the expected events are applied.

func ThenFailWith

func ThenFailWith(want error) ThenFn

ThenFailWith asserts that the expected error occurred.

type WhenFn

type WhenFn func(agg cqrs.ESAggregate, err error) ([]cqrs.DomainEvent, error)

WhenFn is a command handler function.

func When

func When(c cqrs.Command) WhenFn

When prepares the command handler for the given command.

Jump to

Keyboard shortcuts

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