1 |
|
2 | import * as Promise from 'bluebird';
|
3 | import { IMessage, UniversalBot } from 'botbuilder';
|
4 | import { IConfig } from './config';
|
5 | import { ExpectedMessage } from './ExpectedMessage';
|
6 | export declare type botToUserMessageCheckerFunction = (msg: IMessage | IMessage[]) => void;
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | export declare class MessageService {
|
12 | private bot;
|
13 | private botToUserMessageChecker;
|
14 | private config;
|
15 | constructor(bot: UniversalBot, config: IConfig);
|
16 | /**
|
17 | * Sends message to bot and sets the expectations for the responses.
|
18 | *
|
19 | * @param message message to send to bot
|
20 | * @param expectedResponses expected responses
|
21 | */
|
22 | sendMessageToBot(message: IMessage, expectedResponses: ExpectedMessage[], ignoreOrder?: boolean): Promise<void>;
|
23 | /**
|
24 | * Sets the current response expectation function for the message service. This allows the botToUserMessageChecker property to be
|
25 | * updated within a closure with the proper expectedResponses. The promise that is returned will only resolve when all responses have
|
26 | * been seen. Many tests will hang here and fail if an expected response is never received
|
27 | *
|
28 | * @param expectedResponses collection of expected responses for a particular step
|
29 | */
|
30 | private setBotToUserMessageChecker(expectedResponses, outgoingMessageComparator);
|
31 | /**
|
32 | * Inject middleware to intercept outgoing messages to check their content
|
33 | */
|
34 | private applyOutgoingMessageListener();
|
35 | }
|