Skip to content

Instantly share code, notes, and snippets.

@microsoftly
Last active August 29, 2017 00:21
Show Gist options
  • Select an option

  • Save microsoftly/9a91591e127056875dc3d7e35a5ade51 to your computer and use it in GitHub Desktop.

Select an option

Save microsoftly/9a91591e127056875dc3d7e35a5ade51 to your computer and use it in GitHub Desktop.
BotTester testing expected responses with strings only
const { BotTester } = require('bot-tester');
const { expect } = require('chai');
describe('Bot Tester', () => {
it('can test prompts', () => {
bot.dialog('/', [(session) => {
new Prompts.text(session, 'Hi there! Tell me something you like');
}, (session, results) => {
session.send(`${results.response} is pretty cool.`);
new Prompts.text(session, 'Why do you like it?');
}, (session) => session.send('Interesting. Well, that\'s all I have for now')]);
return new BotTester(bot)
.sendMessageToBot('Hola!', 'Hi there! Tell me something you like')
.sendMessageToBot('The sky', 'The sky is pretty cool.', 'Why do you like it?')
.sendMessageToBot('It\'s blue', 'Interesting. Well, that\'s all I have for now')
.runTest();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment