Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge branch 'benbrown/4.7' into benbrown/1878
Browse files Browse the repository at this point in the history
  • Loading branch information
benbrown committed Mar 12, 2020
2 parents e46ba7a + b1d4c77 commit db64e24
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions packages/botkit/tests/Dialog.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,38 @@ describe('Botkit dialog', function() {
assert(reply2 == null, 'wrong reply 2');
});

it('should work with call to beginDialog in handler', async function() {
const botConvo = new BotkitConversation('testConvo', bot);
botConvo.ask('What is your name?', async (response, convo, bot) => {
await bot.beginDialog('testConvo2');
}, 'name');
botConvo.say('got it.');
bot.addDialog(botConvo);

const botConvo2 = new BotkitConversation('testConvo2', bot);
botConvo2.ask('What is your favorite color?', async (response, convo, bot) => {
// noop
}, 'color');
botConvo2.say('ok you said {{vars.color}}');
bot.addDialog(botConvo2);

// set up a test client
const client = new BotkitTestClient('test', bot, ['testConvo', 'testConvo2']);

const prompt = await client.sendActivity('..');
assert(prompt.text === 'What is your name?', 'wrong prompt 1');

const prompt2 = await client.sendActivity('ben');
assert(prompt2.text === 'What is your favorite color?', 'wrong prompt 2');

const reply = await client.sendActivity('black');
assert(reply.text === 'ok you said black', 'wrong reply');

const reply2 = await client.getNextReply();
assert(reply2 === 'got it.', 'wrong reply 2');
});


it('should navigate threads', async function() {
// test all the ways threads are triggered
// convo.gotoThread inside an ask
Expand Down

0 comments on commit db64e24

Please sign in to comment.