Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestContext ¶
type TestContext struct {
// contains filtered or unexported fields
}
TestContext is a context you can wired up directly to an event machine so that you can test state entry functions and how they affect state
func NewTestContext ¶
func NewTestContext(ctx context.Context, eventProcessor fsm.EventProcessor) *TestContext
NewTestContext returns a new test context for the given event machien
func (*TestContext) Context ¶
func (tc *TestContext) Context() context.Context
Context returns the golang context for this context
func (*TestContext) ReplayEvents ¶
func (tc *TestContext) ReplayEvents(t *testing.T, user interface{})
ReplayEvents will use the eventProcessor to attempt to perform the dispatched transitions on the given state object. it will fail the test if any of them fail
func (*TestContext) Trigger ¶
func (tc *TestContext) Trigger(event fsm.EventName, args ...interface{}) error
Trigger initiates a state transition with the named event.
The call takes a variable number of arguments that will be passed to the callback, if defined.
It will return nil if the event is one of these errors:
- event X does not exist
- arguments don't match expected transition