Documentation
¶
Index ¶
- type TestingTraverser
- func (t *TestingTraverser) CurrentState() string
- func (t *TestingTraverser) Delete(key string) error
- func (t *TestingTraverser) Fetch(key string) (interface{}, error)
- func (t *TestingTraverser) GetAllReceived() []interface{}
- func (t *TestingTraverser) GetReceived() interface{}
- func (t *TestingTraverser) Send(input string)
- func (t *TestingTraverser) SetCurrentState(state string)
- func (t *TestingTraverser) SetUUID(uuid string)
- func (t *TestingTraverser) UUID() string
- func (t *TestingTraverser) Upsert(key string, value interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestingTraverser ¶
type TestingTraverser struct {
// contains filtered or unexported fields
}
TestingTraverser is a fsm.Traverser, with an additional three methods: Send(), GetReceived(), and GetAllReceived()
func New ¶
func New(stateMachine fsm.StateMachine, store fsm.Store) *TestingTraverser
New creates and returns a new *TestingTraverser, which can be used to build automated tests for State Machines
func (*TestingTraverser) CurrentState ¶
func (t *TestingTraverser) CurrentState() string
CurrentState returns the current active state the Traverser is in. Be sure to call this only after you have called at least one `Send()` to this Traverser.
func (*TestingTraverser) Delete ¶
func (t *TestingTraverser) Delete(key string) error
Delete deletes a variable set to this traverser. Be sure to call this only after you have called at least one `Send()` to this Traverser.
func (*TestingTraverser) Fetch ¶
func (t *TestingTraverser) Fetch(key string) (interface{}, error)
Fetch returns a variable set to this traverser. Be sure to call this only after you have called at least one `Send()` to this Traverser.
func (*TestingTraverser) GetAllReceived ¶
func (t *TestingTraverser) GetAllReceived() []interface{}
GetAllReceived returns an array of all of the messages sent to this traverser. Think of this as a queue, and GetAllReceived() is simply flush().
func (*TestingTraverser) GetReceived ¶
func (t *TestingTraverser) GetReceived() interface{}
GetReceived returns the first message that was sent to the traverser that hasn't been received yet. Think of this as a queue and GetReceived() is simply dequeue().
func (*TestingTraverser) Send ¶
func (t *TestingTraverser) Send(input string)
Send emulates a user sending a message to a chat-bot.
func (*TestingTraverser) SetCurrentState ¶
func (t *TestingTraverser) SetCurrentState(state string)
SetCurrentState sets the current state. This can be useful for jumping around specific parts of your bot flow. Be sure to call this only after you have called at least one `Send()` to this Traverser.
func (*TestingTraverser) SetUUID ¶
func (t *TestingTraverser) SetUUID(uuid string)
SetUUID sets a new UUID to the traverser. It's not advised to set this yourself. Be sure to call this only after you have called at least one `Send()` to this Traverser.
func (*TestingTraverser) UUID ¶
func (t *TestingTraverser) UUID() string
UUID returns the Traversers UUID
func (*TestingTraverser) Upsert ¶
func (t *TestingTraverser) Upsert(key string, value interface{}) error
Upsert updates (or creates) a variable for this traverser. Be sure to call this only after you have called at least one `Send()` to this Traverser.
