Documentation ¶
Index ¶
- Variables
- func AssertEqualJSON(t *testing.T, expected json.RawMessage, actual json.RawMessage, ...) bool
- func AssertSnapshot(t *testing.T, name, expected string)
- func AssertXEqual(t *testing.T, expected types.XValue, actual types.XValue, ...) bool
- func CreateSessionAssets(assetsJSON json.RawMessage, testServerURL string) (flows.SessionAssets, error)
- func CreateTestSession(testServerURL string, redact envs.RedactionPolicy) (flows.Session, []flows.Event, error)
- func CreateTestVoiceSession(testServerURL string) (flows.Session, []flows.Event, error)
- func JSONDelete(data json.RawMessage, path []string) json.RawMessage
- func JSONReplace(data json.RawMessage, path []string, value json.RawMessage) json.RawMessage
- func LoadFlowFromAssets(env envs.Environment, path string, uuid assets.FlowUUID) (flows.Flow, error)
- func LoadSessionAssets(env envs.Environment, path string) (flows.SessionAssets, error)
- func NewChannel(name string, address string, schemes []string, roles []assets.ChannelRole, ...) *flows.Channel
- func NewClassifier(name, type_ string, intents []string) *flows.Classifier
- func NewEngine() flows.Engine
- func NewTelChannel(name string, address string, roles []assets.ChannelRole, ...) *flows.Channel
- func NewTestHTTPServer(port int) *httptest.Server
- func NewTicketService(ticketer *flows.Ticketer) flows.TicketService
- func NormalizeJSON(data json.RawMessage) ([]byte, error)
- func ResumeSession(session flows.Session, assetsJSON json.RawMessage, msgText string) (flows.Session, flows.Sprint, error)
- type EventLog
- type SessionBuilder
- func (b *SessionBuilder) Build() (flows.Session, flows.Sprint, error)
- func (b *SessionBuilder) MustBuild() (flows.Session, flows.Sprint)
- func (b *SessionBuilder) WithAssets(assetsJSON []byte) *SessionBuilder
- func (b *SessionBuilder) WithAssetsPath(path string) *SessionBuilder
- func (b *SessionBuilder) WithContact(uuid flows.ContactUUID, id flows.ContactID, name string, lang envs.Language, ...) *SessionBuilder
- func (b *SessionBuilder) WithEnvironment(env envs.Environment) *SessionBuilder
- func (b *SessionBuilder) WithFlow(flowUUID assets.FlowUUID) *SessionBuilder
- func (b *SessionBuilder) WithTriggerMsg(text string) *SessionBuilder
Constants ¶
This section is empty.
Variables ¶
var UpdateSnapshots bool
UpdateSnapshots indicates whether tests should update snapshots
Functions ¶
func AssertEqualJSON ¶ added in v0.23.0
func AssertEqualJSON(t *testing.T, expected json.RawMessage, actual json.RawMessage, msgAndArgs ...interface{}) bool
AssertEqualJSON checks two JSON strings for equality
func AssertSnapshot ¶ added in v0.115.3
AssertSnapshot checks that the file contains the expected text. However it creates the file if -update was set or file doesn't exist.
func AssertXEqual ¶ added in v0.115.3
func AssertXEqual(t *testing.T, expected types.XValue, actual types.XValue, msgAndArgs ...interface{}) bool
AssertXEqual is equivalent to assert.Equal for two XValue instances
func CreateSessionAssets ¶ added in v0.115.3
func CreateSessionAssets(assetsJSON json.RawMessage, testServerURL string) (flows.SessionAssets, error)
CreateSessionAssets creates assets from given JSON
func CreateTestSession ¶
func CreateTestSession(testServerURL string, redact envs.RedactionPolicy) (flows.Session, []flows.Event, error)
CreateTestSession creates a standard example session for testing
func CreateTestVoiceSession ¶ added in v0.115.3
CreateTestVoiceSession creates a standard example session for testing voice flows and actions
func JSONDelete ¶ added in v0.115.3
func JSONDelete(data json.RawMessage, path []string) json.RawMessage
JSONDelete deletes a node in JSON
func JSONReplace ¶ added in v0.115.3
func JSONReplace(data json.RawMessage, path []string, value json.RawMessage) json.RawMessage
JSONReplace replaces a node in JSON
func LoadFlowFromAssets ¶ added in v0.115.3
func LoadSessionAssets ¶ added in v0.115.3
func LoadSessionAssets(env envs.Environment, path string) (flows.SessionAssets, error)
LoadSessionAssets loads a session assets instance from a static JSON file
func NewChannel ¶ added in v0.15.0
func NewChannel(name string, address string, schemes []string, roles []assets.ChannelRole, parent *assets.ChannelReference) *flows.Channel
func NewClassifier ¶ added in v0.115.3
func NewClassifier(name, type_ string, intents []string) *flows.Classifier
func NewTelChannel ¶ added in v0.15.0
func NewTestHTTPServer ¶
NewTestHTTPServer sets up a mock server for webhook actions
func NewTicketService ¶ added in v0.115.3
func NewTicketService(ticketer *flows.Ticketer) flows.TicketService
NewTicketService creates a new ticket service for testing
func NormalizeJSON ¶ added in v0.23.0
func NormalizeJSON(data json.RawMessage) ([]byte, error)
NormalizeJSON re-formats the given JSON
Types ¶
type EventLog ¶ added in v0.115.3
EventLog is a utility for testing things which take an event logger function
func NewEventLog ¶ added in v0.115.3
func NewEventLog() *EventLog
NewEventLog creates a new event log
type SessionBuilder ¶ added in v0.115.3
type SessionBuilder struct {
// contains filtered or unexported fields
}
func NewSessionBuilder ¶ added in v0.115.3
func NewSessionBuilder() *SessionBuilder
func (*SessionBuilder) MustBuild ¶ added in v0.115.3
func (b *SessionBuilder) MustBuild() (flows.Session, flows.Sprint)
func (*SessionBuilder) WithAssets ¶ added in v0.115.3
func (b *SessionBuilder) WithAssets(assetsJSON []byte) *SessionBuilder
func (*SessionBuilder) WithAssetsPath ¶ added in v0.115.3
func (b *SessionBuilder) WithAssetsPath(path string) *SessionBuilder
func (*SessionBuilder) WithContact ¶ added in v0.115.3
func (b *SessionBuilder) WithContact(uuid flows.ContactUUID, id flows.ContactID, name string, lang envs.Language, urn urns.URN) *SessionBuilder
func (*SessionBuilder) WithEnvironment ¶ added in v0.115.3
func (b *SessionBuilder) WithEnvironment(env envs.Environment) *SessionBuilder
func (*SessionBuilder) WithFlow ¶ added in v0.115.3
func (b *SessionBuilder) WithFlow(flowUUID assets.FlowUUID) *SessionBuilder
func (*SessionBuilder) WithTriggerMsg ¶ added in v0.115.3
func (b *SessionBuilder) WithTriggerMsg(text string) *SessionBuilder