Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MessageService

Handles sending messages to bot, intercepts the responses, and compares the response to the expected responses for the particular test step

Hierarchy

  • MessageService

Index

Constructors

constructor

Properties

Private bot

bot: UniversalBot

Private botToUserMessageChecker

botToUserMessageChecker: botToUserMessageCheckerFunction

Private config

config: IConfig

Methods

Private applyOutgoingMessageListener

  • applyOutgoingMessageListener(): void
  • Inject middleware to intercept outgoing messages to check their content

    Returns void

sendMessageToBot

  • sendMessageToBot(message: IMessage, expectedResponses: ExpectedMessage[], ignoreOrder?: boolean): Promise<void>
  • Sends message to bot and sets the expectations for the responses.

    Parameters

    • message: IMessage

      message to send to bot

    • expectedResponses: ExpectedMessage[]

      expected responses

    • Default value ignoreOrder: boolean = false

    Returns Promise<void>

Private setBotToUserMessageChecker

  • Sets the current response expectation function for the message service. This allows the botToUserMessageChecker property to be updated within a closure with the proper expectedResponses. The promise that is returned will only resolve when all responses have been seen. Many tests will hang here and fail if an expected response is never received

    Parameters

    Returns Promise<void>