1 | /**
|
2 | * @module botkit
|
3 | */
|
4 | /**
|
5 | * Copyright (c) Microsoft Corporation. All rights reserved.
|
6 | * Licensed under the MIT License.
|
7 | */
|
8 | import { Activity, ConversationState, Middleware, TestAdapter } from 'botbuilder-core';
|
9 | import { DialogTurnResult } from 'botbuilder-dialogs';
|
10 | import { Botkit } from './core';
|
11 | /**
|
12 | * A client for testing dialogs in isolation.
|
13 | */
|
14 | export declare class BotkitTestClient {
|
15 | private readonly _callback;
|
16 | private readonly _testAdapter;
|
17 | dialogTurnResult: DialogTurnResult;
|
18 | conversationState: ConversationState;
|
19 | /**
|
20 | * Create a BotkitTestClient to test a dialog without having to create a full-fledged adapter.
|
21 | *
|
22 | * ```javascript
|
23 | * let client = new BotkitTestClient('test', bot, MY_DIALOG, MY_OPTIONS);
|
24 | * let reply = await client.sendActivity('first message');
|
25 | * assert.strictEqual(reply.text, 'first reply', 'reply failed');
|
26 | * ```
|
27 | *
|
28 | * @param channelId The channelId to be used for the test.
|
29 | * Use 'emulator' or 'test' if you are uncertain of the channel you are targeting.
|
30 | * Otherwise, it is recommended that you use the id for the channel(s) your bot will be using and write a test case for each channel.
|
31 | * @param bot (Required) The Botkit bot that has the skill to test.
|
32 | * @param dialogToTest (Required) The identifier of the skill to test in the bot.
|
33 | * @param initialDialogOptions (Optional) additional argument(s) to pass to the dialog being started.
|
34 | * @param middlewares (Optional) a stack of middleware to be run when testing
|
35 | * @param conversationState (Optional) A ConversationState instance to use in the test client
|
36 | */
|
37 | constructor(channelId: string, bot: Botkit, dialogToTest: string | string[], initialDialogOptions?: any, middlewares?: Middleware[], conversationState?: ConversationState);
|
38 | constructor(testAdapter: TestAdapter, bot: Botkit, dialogToTest: string | string[], initialDialogOptions?: any, middlewares?: Middleware[], conversationState?: ConversationState);
|
39 | /**
|
40 | * Send an activity into the dialog.
|
41 | * @returns a TestFlow that can be used to assert replies etc
|
42 | * @param activity an activity potentially with text
|
43 | *
|
44 | * ```javascript
|
45 | * DialogTest.send('hello').assertReply('hello yourself').then(done);
|
46 | * ```
|
47 | */
|
48 | sendActivity(activity: Partial<Activity> | string): Promise<any>;
|
49 | /**
|
50 | * Get the next reply waiting to be delivered (if one exists)
|
51 | */
|
52 | getNextReply(): Partial<Activity>;
|
53 | private getDefaultCallback;
|
54 | private addUserMiddlewares;
|
55 | }
|